syaminismail
2 Answer(s)      5 years and 11 months ago
Posted in : Struts

1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers in ascending order. Write down in a table the time (according to your system clock) that it takes for the program to complete. You may do this by running the program for several values of input.

Hints: a) Write full source code b) Use system clock to measure the running time c) Use several input (eg: N = 100 , N = 1000 , N = 10000, N = 100000 etc) d) Have access to a file (to store your running time)

2) What is the difference between static and dynamic memory allocations? List advantages and disadvantages for the both type of memory allocations.

3) Use structure to wrap student information (such as Matrix Number, name and MTS 3023 mark) and manipulate it by reading information to an array of student structure and print them on to console screen.

4) The common error message which might encounter in your program is ?memory access violation? or ?segmentation violation?. What does it mean? How to avoid it?

5) For each of the following four program fragments: a. Give an analysis of the running time (Big-Oh) b. Implement the code and give the running time for several values of N c. Compare your analysis with the actual running times

October 4, 2011 at 12:06 PM

C++ Bubble Sort

```#include <iostream>
using namespace std;

void sort(int ar[], int size)
{
int temp;
for(int i = 0; i < size; i++)
for(int j = 0; j < size - i - 1; j++)
if(ar[j] > ar[j + 1])
{
temp = ar[j];
ar[j] = ar[j + 1];
ar[j + 1] = temp;
}
}

int main()
{
int *array;
int size;
cout << "Enter size of array: ";
cin >> size;
array = new int[size];
for (int x = 0; x < size; x++)
{
cout << "Enter value for index " << x + 1 << ": ";
cin >> array[x];
}
cout << "Before sorting: ";
for (int i = 0; i < size; i++)
{
if (i == (size - 1))
cout << array[i];
else
cout << array[i] << ", ";
}
sort(array, size);
cout << "\nAfter sorting: ";
for (int j = 0; j < size; j++)
{
if (j == (size - 1))
cout << array[j];
else
cout << array[j] << ", ";
}
cin.ignore();
cin.get();
delete array;
return 0;
}
```

October 4, 2011 at 12:23 PM

Difference between Static and Dynamic Memory Allocation:

1)Dynamic memory allocation is at runtime. static memory allocation is before run time, but the values of variables may be changed at run time. Static memory allocation saves running time, but can't be possible in all cases.

2)Dynamic memory allocation stores it's memory on heap, and the static memory allocation stores it's data in the "data segment" of the memory.

please help me to answers this question about C++.....huuhuhuhu  1... clock to measure the running time c) Use several input (eg: N = 100 , N = 1000.... Implement the code and give the running time for several values of N c. Compare your
please help me to answers this question about C++.....huuhuhuhu  1... clock to measure the running time c) Use several input (eg: N = 100 , N = 1000.... Implement the code and give the running time for several values of N c. Compare your
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  1) Copy one file content to other? 2) Count the number of words in a file
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
I really need help with this assignment question Please help me out Please  * Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about
Please help me.  Hi i am trinath in below there is a url.In that url there is a code of edit a jsp page.I understand that code but only one thing i...://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search
help me please   Hello I want helping for this question , Please Write a program that reads some friendsÃ¢â?¬â?¢ names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
please help me.  I have three table in mysql,and i hava create a excel sheet and add this sheet.but my question is in every sheet i can display one one table result.how can i do
please help me.  I have a jsp page under that i add a list box under i get the countries through my database. so how can i do
before. This name list should get from the database. Please help me. By the way, I'm...please help me  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another
please help me...  write an application that print number in the following order using a FOR-Loop 1 2 3 4 5 2 4 6 8 10 3 6 9 1215 4 8 121620 5 10152025
please help me in these prog   create 2 jdbc programs including awt create 2 jdbc programs including swing create 2 jdbc programs including command line argument create 2 jdbc programs including io class 4 jdbc prog using
please help me to this problem..  i wrote a program like keyboard... inside the JTextField) but i want to make this program to let me write where i clicked (i.e allows me to write any thing at the field where i clicked
Please help me out    Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about the laptops lent to the students. Users can add or remove data
Please help me urgent...........  For what kind of a problem would use a Tree Set and not a Tree Map For what kind of a problem would use a Tree Map and not a Tree Set   Hello Friend, If you want to display the list
Please help me  program for when a user enter his card number, it has to create default security pin in the database
Please help me  Hi Sir, please send me the code for the following progrems... 1) all sets are integer type: input: set1={10,20,30,40} set2={15,25,35} output: union={10,15,20,25,30,35,40} 2) input: "Hi what
Help me please!!! - Java Beginners
please help me  interface Test1 { String toString(); } public class Test { public static void main(String[] args) { System.out.println(new Test1() { public String toString() { return "test
help me please  how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks