Results 1 to 2 of 2

Thread: Algorithm (PSEUDOCODE HELP)

  1. #1
    New Member
    Join Date
    Sep 2017
    HSC
    2018
    Gender
    Male
    Posts
    1
    Rep Power
    2

    Algorithm (PSEUDOCODE HELP)

    For software homework I need to create a pseudocode algorithm which reads a list of best scores (up to 5) from a sequential file and determines whether the current score (in a game) should be inserted into the list (leaderboard)

    USING:
    Algorithm from the HSC Past Paper:
    Code:
    BEGIN swap(x)
      temp = TOPPLAYERS[x]
      TOPPLAYERS[x] = TOPPLAYERS[x-1]
      TOPPLAYERS[x-1] = temp
    END swap
    
    IF newscore > TOPPLAYERS[10].totalscore THEN
      TOPPLAYERS[10].totalscore = newscore
      TOPPLAYERS[10].name = newname
      found = false
      x =10
      WHILE found = false AND x > 1
         IF TOPPLAYERS(x).totalscore > TOPPLAYERS[x – 1].totalscore THEN
             swap(x)
              x = x – 1
         ELSE 
              found = true 
         ENDIF 
       ENDWHILE
    ENDIF

    And the Standard Sequential File Algorithms (via Course Specifications page 65-66)

    https://www.boardofstudies.nsw.edu.a...urse-specs.pdf

  2. #2
    New Member
    Join Date
    Nov 2016
    HSC
    2018
    Gender
    Male
    Posts
    5
    Rep Power
    2

    Re: Algorithm (PSEUDOCODE HELP)

    so... what is your question?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •