title: Search and Bubble Sort Array in Javascript
body: <p>Alright, so I'm really having trouble with this lab for my class.
  Here's the problem:</p>
  
  <p>Initialization: Randomly initialize a list of size 200 with integer values between 0 and 100.
  Part 1: Search
  You are to implement a function which searches a list for an occurence of a value. It should not depend on the list being pre-sorted.</p>
  
  <p>Search
  Section     Specification   Comments
  INPUT:  list, value     An initialized list
  COMPUTATION:    </p>
  
  <pre><code>Loop over all elements in list.
      If current element equals value, store as index.
  If value not found, ensure index is -1.
  </code></pre>
  
  <p>RETURN:     index   -1 if value not found</p>
  
  <pre><code>Prompt the user once for an element (an integer from 0 to 100) to search for.
  Call your search function with the number to search for and the list.
  Display whether the number was found, and if found, a location where it can be found within the list.
  </code></pre>
  
  <p>Part 2: Sort
  You are to implement a function which sorts a list in ascending (0, 1, ...) order. You are not permitted to use JavaScript's sort() method.
  There are many ways to sort a list of which you may implement any method you see fit, provided it sorts a list in ascending order. Below describes Bubble Sort, one of the most straight-forward approaches to sorting.</p>
  
  <p>Sort
  Section     Specification   Comments
  INPUT:  list    An initialized list
  OTHER VARIABLES:    swap
  n   Indicates if swap occurred.
  How far to search in the list.
  COMPUTATION:    </p>
  
  <pre><code>Set n to size of list - 1.
  Set swap to FALSE.
  Loop over element 0 through element n in the list.
      If current element &gt; next element
          Swap current element and next element.
          Set swap to TRUE.
  If swap is TRUE, repeat from step 2. n -= 1.
  If swap is FALSE, return the now sorted list.
  
  Gradually sorts a list.
  </code></pre>
  
  <p>nth item is correctly placed.
  RETURN:     list</p>
  
  <pre><code>Call your sort function for your list. You are not permitted to call Javascript's sort() method.
  Display the (sorted) list.
  </code></pre>
  
  <p>I'm not asking you to do my homework but can you please just point me in the right direction? I figured out how to do the bubble sort but the search part is what I'm mostly having problems with.</p>