This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 2606 Data Structures & OO Devel II Homework 1: Complexity Last modified: 9/10/2007 7:44:31 AM 1 You will submit your solution to this assignment to the Curator System (as HW1 ). Your solution must be either a plain text file (e.g., NotePad) or a MS Word document; submissions in other formats will not be graded. Partial credit will only be given if you show relevant work. 1. Consider the following algorithm: string BinaryRep; // Line 1 if (numBytes <= 0) return BinaryRep; // 2 BinaryRep = ByteToString(p[0]); // 3 for ( int Byte = 1; Byte < numBytes; Byte++) { // 4 BinaryRep = ByteToString(p[Byte]) + " " + BinaryRep; // 5 } a) [15 points] Using the rules given in the course notes, perform an exact count worstcase complexity analysis of the algorithm above, and state the corresponding function T(N). N is numBytes , and the body of ByteToString() executes 30 instructions. Variable declarations don't require any operations we're counting....
View
Full
Document
This note was uploaded on 04/14/2008 for the course CS 2606 taught by Professor Wdmcquain during the Fall '07 term at Virginia Tech.
 Fall '07
 WDMcQuain
 Data Structures

Click to edit the document details