Click here to Skip to main content
15,902,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: How to convert CString to WCHAR*? Pin
Rajesh R Subramanian2-Mar-08 18:57
professionalRajesh R Subramanian2-Mar-08 18:57 
GeneralRe: How to convert CString to WCHAR*? Pin
Mark Salsbery2-Mar-08 19:17
Mark Salsbery2-Mar-08 19:17 
GeneralRe: How to convert CString to WCHAR*? Pin
ThatsAlok2-Mar-08 19:28
ThatsAlok2-Mar-08 19:28 
GeneralRe: How to convert CString to WCHAR*? Pin
Rajesh R Subramanian2-Mar-08 20:13
professionalRajesh R Subramanian2-Mar-08 20:13 
Questionwhy maskX[j] value can't change? Pin
gentleguy2-Mar-08 13:48
gentleguy2-Mar-08 13:48 
AnswerRe: why maskX[j] value can't change? [modified] Pin
TooShy2Talk2-Mar-08 15:36
TooShy2Talk2-Mar-08 15:36 
AnswerRe: why maskX[j] value can't change? Pin
David Crow2-Mar-08 16:40
David Crow2-Mar-08 16:40 
Generalc++ generic dynamic array.. Pin
maggieshah2-Mar-08 12:02
maggieshah2-Mar-08 12:02 
Generic Dynamic Array with Sorting Algorithm
Perspective
Understand the use of a generic container in a specific context. Understand efficiency of an algorithm.
Assignment

For the use in a generic library your array should be expanded.
At this point you are not expected to know the impact on the design of the array why the some basic design requirements follows.
• intensive insert and delete operations anywhere in the container
• different kind of sorting algorithms will be used
• first when the application is designed the actual type to be stored is known (and that may be any type)
The customer finds it hard to develop algorithms to sort items in the list. Therefore you are requested to make a sort() algorithm in your list.
Hint: Choose a simple one like insert sort or selection sort; more efficient algorithms like quick sort, heap sort, and merge sort are more complicated to implement (will be covered in a later session).
For each design decision you must argue for your choice, pre-and cons.
Algorithm Efficiency

As part of efficiency measurements you have to analyze the running time (O – notation) of your algorithms, best-case, average-case and worst-case.
Your management wants a comparison among different techniques:
o Sorting a vector (from the STL) using selection sort and quick sort
o Sorting your array using newly developed algorithm
In order to make it possible to compare the different containers/algorithms you must (of course) use the same data to all of them.
a) create a vector with random numbers (v_rand)
b) create a new vector, copy a) hereto and sort it in ascending order (v_ascend)
c) create a new vector, copy a) hereto and sort it in descending order (v_descend)
It may be reasonably to assume that best-case and worst-case may arise if the data is already ordered as b) and c), but this is not always true.
In turn copy a), b) and c) to the container under test and start the measurement:

o start the stopwatch
o do the sorting
o stop the stopwatch and read the time elapsed
In a non-real-time environment (as in your Windows PC) time measurements will not be accurate. Therefore you should relate the measurements e.g.:
J2C++ Mandatory Assignment 3 Spring 207
Data Structures and Algorithm Generic Dynamic Array
time_relation = time(500.000 elements)/time(10.000 elements)
and relate the the corresponding O for the algorithm used e.g.:
O(n2) -> O_relation = (500.000/10.000)2
Compare the time_relation and the O_relation.
Do the calculations lead to expected results? (Eventually why not?)
Tools
ls:


o Selection sort
o Quick sort
o Random.h (0 … 231 -1) [The standard random generator has max. span 0…215-1]
To find corresponding O’s please consult the book Data Structures with C++
o An example in how to use above

Test
The test should be divided into two
1. Test insert and retrieve and delete of a number of elements anywhere in the list
2. Test the efficiency of your sorting algorithm. Estimate the O() with proper documentation (ref. Algorithm Efficiency above)
Documentation
All classes and functions must be documented in such a way that any other software developer will be able to use your solution.
The names of the developers must be stated in the head of all classes together with dates and revision number.
All prototypes of the functions (in header file) should have stated the pre – and post
GeneralRe: c++ generic dynamic array.. Pin
Dave Doknjas2-Mar-08 12:14
Dave Doknjas2-Mar-08 12:14 
GeneralRe: c++ generic dynamic array.. Pin
Dave Calkins2-Mar-08 15:44
Dave Calkins2-Mar-08 15:44 
QuestionHow to save Printer HDC to .EMF file ? Pin
GuimaSun2-Mar-08 11:40
GuimaSun2-Mar-08 11:40 
AnswerRe: How to save Printer HDC to .EMF file ? Pin
Mark Salsbery2-Mar-08 13:48
Mark Salsbery2-Mar-08 13:48 
GeneralRe: How to save Printer HDC to .EMF file ? Pin
GuimaSun2-Mar-08 14:42
GuimaSun2-Mar-08 14:42 
GeneralRe: How to save Printer HDC to .EMF file ? Pin
Mark Salsbery2-Mar-08 17:44
Mark Salsbery2-Mar-08 17:44 
GeneralRe: How to save Printer HDC to .EMF file ? Pin
GuimaSun3-Mar-08 2:14
GuimaSun3-Mar-08 2:14 
GeneralHOOK, what and how to hook Pin
swarup2-Mar-08 8:54
swarup2-Mar-08 8:54 
GeneralRe: HOOK, what and how to hook Pin
swarup2-Mar-08 21:55
swarup2-Mar-08 21:55 
GeneralRe: HOOK, what and how to hook Pin
Pete O'Hanlon3-Mar-08 1:54
mvePete O'Hanlon3-Mar-08 1:54 
GeneralRe: HOOK, what and how to hook Pin
swarup3-Mar-08 4:20
swarup3-Mar-08 4:20 
GeneralRe: HOOK, what and how to hook Pin
Justin Perez3-Mar-08 5:09
Justin Perez3-Mar-08 5:09 
GeneralRe: HOOK, what and how to hook Pin
swarup3-Mar-08 5:22
swarup3-Mar-08 5:22 
Generaldouble Pin
viliam2-Mar-08 8:48
viliam2-Mar-08 8:48 
GeneralRe: double Pin
Alexander M.,3-Mar-08 3:31
Alexander M.,3-Mar-08 3:31 
GeneralRe: double Pin
viliam3-Mar-08 4:10
viliam3-Mar-08 4:10 
Generallogic of a small game Pin
tashe2-Mar-08 6:47
tashe2-Mar-08 6:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.