Skip to main content
November 24, 2022
Question

Bubble Sort Algorithm i tried , but i did not get exact result , this logic possible in appian

  • November 24, 2022
  • 2 replies
  • 0 views
  • Bubble sort starts with very first two elements, comparing them to check which one is greater.
    • ( 5 1 4 2 8 ) –> ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1. 
    • ( 1 5 4 2 8 ) –>  ( 1 4 5 2 8 ), Swap since 5 > 4 
    • ( 1 4 5 2 8 ) –>  ( 1 4 2 5 8 ), Swap since 5 > 2 
    • ( 1 4 2 5 8 ) –> ( 1 4 2 5 8 ), Now, since these elements are already in order (8 > 5), algorithm does not swap them.

2 replies

jakubf0002
November 24, 2022

I would rather use build in function todatasubset which gives you an option to sort. Build in function will be faster that custom code.

docs.appian.com/.../fnc_scripting_todatasubset.html

November 24, 2022

it is directly converting sorting asc and desc , i expected interchange two values step by step bubble sort order