Linear arrays: Difference between revisions

From Computer Science Wiki
No edit summary
No edit summary
Line 4: Line 4:


You will remember we use  [[arrays|arrays]] to hold values of the same type at contiguous memory locations. In particular, the use of arrays allows us to create "groups" or "clusters" of variables without needing to give a unique variable name to each, but still allowing us to individually index into the elements of the array.<ref>http://cs50.wiki/Arrays+and+strings</ref>
You will remember we use  [[arrays|arrays]] to hold values of the same type at contiguous memory locations. In particular, the use of arrays allows us to create "groups" or "clusters" of variables without needing to give a unique variable name to each, but still allowing us to individually index into the elements of the array.<ref>http://cs50.wiki/Arrays+and+strings</ref>
== Standard algorithms ==


* Sequential search
* Sequential search
Line 10: Line 12:
* Selection sort
* Selection sort


=== Sequential search ===
In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched.<ref>https://en.wikipedia.org/wiki/Linear_search</ref>


== Do you understand this? ==
== Do you understand this? ==

Revision as of 17:14, 27 July 2017

Linear arrays[1]

There are four common algorithms we use on a linear array. Although the IB asks only for you to know these at the pseudocode level, I suggest you memorize these for the rest of your life.

You will remember we use arrays to hold values of the same type at contiguous memory locations. In particular, the use of arrays allows us to create "groups" or "clusters" of variables without needing to give a unique variable name to each, but still allowing us to individually index into the elements of the array.[2]

Standard algorithms[edit]

  • Sequential search
  • Binary search
  • Bubble sort
  • Selection sort

Sequential search[edit]

In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched.[3]

Do you understand this?[edit]

Standards[edit]

These standards are used from the IB Computer Science Subject Guide[4]

  • Describe the characteristics of standard algorithms on linear arrays.

References[edit]

  1. http://www.flaticon.com/
  2. http://cs50.wiki/Arrays+and+strings
  3. https://en.wikipedia.org/wiki/Linear_search
  4. IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.