Computer and Information Science - Lecture Notes | CISC 106, Study Guides, Projects, Research of Computer Science

Material Type: Project; Class: General Computer Science for Engineers; Subject: Computer/Information Sciences; University: University of Delaware; Term: Spring 2009;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 09/02/2009

koofers-user-19w-1
koofers-user-19w-1 🇺🇸

9 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Dr. John Cavazos
Computer and Information Sciences
04/08/2009
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Computer and Information Science - Lecture Notes | CISC 106 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Dr. John Cavazos Computer and Information Sciences 04/08/

 Project 1 update  Pseudo Code  Checking if an Array is Sorted  Finding a number in an Array

 Simple Example : Add all numbers in array Intialize i to zero for n from 1 to end of array i = i + array(n) return value of i

Arrays

A = [ 3 7 10 15 19 33]

A

Check all numbers in array if the one before is less than the one after If array(n) > array(n+1) array not sorted

function sorted = isArraySorted (array) initialize sorted to true len = length of array minus 1 for j = 1 to len if array(j) > array(j+1) sorted is false

Tackling a Problem

Write English first!

. What are the data structures

needed?

. Do I need a loop? What kind

would work best?

. Then write pseudo code.

Finding an number in array

  • Store numbers in array
  • Initialize array index to 1
  • Initialize number found boolean variable
  • while number not found or array length not exceeded
  • if current array position has num
  • set number found
  • end
  • If number found report!