Pseudo Code on Collection 16 Sep Past paper question 13 parts b,c and d

Home Forums IB Pseudo Code Pseudo Code on Collection 16 Sep Past paper question 13 parts b,c and d

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6640
    Eamonn
    Keymaster

    Share your pseudo code solution for moving the collection names into 2 arrays past paper 2021 (Q13 Part b,c and d ) link here

    #6654
    Shiva Chandnani
    Participant

    SURNAME = [ ]
    FIRSTNAME = [ ]

    loop for i from 0 to n-1-i
    loop for j from 0 to n-1-i
    if SURNAME[j] > SURNAME[j+1] then
    larger = SURNAMES[j]
    SURNAME[j] = SURNAME[j+1]
    SURNAME[j+1] = larger
    larger = FIRSTNAME[j]
    FIRSTNAME[j] = FIRSTNAME[j+1]
    FIRSTNAME[j+1] = larger
    end if
    end loop
    end loop

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Scroll to Top