Docsity

Questions for Assignment 6 - Introduction to Computer Programming Visual Basic | CS 0004, Assignments of Computer Science

Toggle sidebar
bg1
CS0004 Written Homework 6: Due 04/17/2008
Searching and Sorting: (chpt 7)
1. Given the following list of numbers, which searching method would you use (linear search,
binary search) and why?
4,7,2,5,1,0,9,8,3
2. What is the maximum possible (worst case) number of steps it would take linear search to find a
number in a list of 10 numbers (and why)?
3. What is the maximum possible (worst case) number of steps it would take binary search to find
a number in an ordered (sorted) list of 10 numbers (and why)?
4. Setting the TimerInterval for the VB Timer control to 5500 will cause the timer to go off (tick)
every seconds
pf3

Partial preview of the text

Download Questions for Assignment 6 - Introduction to Computer Programming Visual Basic | CS 0004 and more Assignments Computer Science in PDF only on Docsity!

CS0004 Written Homework 6: Due 04/17/

Searching and Sorting: (chpt 7)

  1. Given the following list of numbers, which searching method would you use (linear search, binary search) and why?

4,7,2,5,1,0,9,8,

  1. What is the maximum possible (worst case) number of steps it would take linear search to find a number in a list of 10 numbers (and why)?
  2. What is the maximum possible (worst case) number of steps it would take binary search to find a number in an ordered (sorted) list of 10 numbers (and why)?
  3. Setting the TimerInterval for the VB Timer control to 5500 will cause the timer to go off (tick) every seconds
  1. Write a simple program (procedure) that goes through a list box (lstDisplay), reads its contents and write them to a file called “out.txt”. (Hint: use a for loop)
  2. Write a program that adds or subtracts two numbers depending on whether the user selects Add or Subtract (radio buttons). When the user clicks “compute” the program computes the value based on the selected option.

Fill in the code: Public Class Form

txtNum

txtNum

txtResult

radSubtract

btnCompute

radAdd