Questions
Discuss the stability of QuickSort and Heapsort. Algorithm coures

  1. Discuss the stability of QuickSort and Heapsort.

Algorithm coures

In: Computer Science

In C create a program that stores contact info. The program must have the following features:...

In C create a program that stores contact info. The program must have the following features:

  • Able to store First Name, Phone Number and Birthday (MM/DD/YYYY)
  • Able to search for a specific contact using First Name, Phone Number and Birthday (find)
  • Able to delete a specific contact using First Name, Phone Number and Birthday (delete)
  • Print entire contact list
  • Show number of entries in contact list
  • Able to save Contact List to file (save)
  • Able to load Contact List from file (load)
  • Able to exit program (exit/quit)

The program must have the following structure:

  • Makefile that completely builds the entire project
  • Main file and library (implementation and header files with header guards)
  • Neat and Tidy code
  • Must have meaningful comments
  • Program must have a command and argument structure
  • Must use a linked list or dynamic array for contact list (NO REGULAR ARRAYS)
  • NO GLOBAL VARIABLES
  • Must use dynamically allocated memory that is correctly managed
  • Must use pointers
  • Must use a decision structure
  • Must give user feedback for all input (“contact list saved”, “entry ‘<user input>’ deleted”, etc.)
  • Must keep contact list sorted by First Name (sort as a new entry is added)
  • Use binary searching algorithm to find entries in contact list
  • All program features must be implemented as a function in a library.

Extra credit:

  • Used meaningful typedefs
  • Used enumerated data types
  • Used conditional operator in an inline if
  • Ask user to save contact list if they haven’t already before exiting

In: Computer Science

AES128 encryption given by the following setting (Note: plaintext, Cipherkey and Ciphertext are Bytes) a. Plaintext:...

AES128 encryption given by the following setting (Note: plaintext, Cipherkey and Ciphertext are Bytes)

a. Plaintext: 00……00 Cipherkey: 00……00 Ciphertext: 66 E9 4B D4 EF 8A 2C 3B 88 4C FA 59 CA 34 2B 2E

b. Plaintext: 00……01 Cipherkey: 00……00 Ciphertext: 58 E2 FC CE FA 7E 30 61 36 7F 1D 57 A4 E7 45 5A

c. Plaintext: 00……00 Cipherkey: 00……01 Ciphertext: 05 45 AA D5 6D A2 A9 7C 36 63 D1 43 2A 3D 1C 84

Please compare the result of the ciphertext from the above questions, and explain what are the difference.

In: Computer Science

You will use your previous programming project as a starting point. Be sure to copy and...

You will use your previous programming project as a starting point. Be sure to copy and rename your file from that project and edit the internal documentation to reflect the new name and date.

Use your previous working Java program as a starting point (Project 3). Create another function that determines whether the customer should receive a discount. Assume your food truck gives a 10% discount on orders over $50 (the total BEFORE tax). If the order is eligible for a discount, then calculate and display the discount. If the order does not get a discount, then still display the discount, but it should be 0. Include a line before this that tells every customer that your business gives a 10% discount on all orders over $50 so they understand this part of their receipt.

And this was the project 3 to be used to write this program.

import java.util.Scanner;

public class Main

{

static double salesTax, amountDueWithTax, totalAmount, amountTendered, change;

static Scanner sc = new Scanner(System.in);

//get all the information about items ordered

public static int[] readData(String items[])

{

int num[] = new int[5];

for(int i=0; i<5; i++)

{

System.out.print("Enter quantity of " + items[i] + " : ");

//get all the information about items ordered and the amount of money tendered as mentioned in ques

num[i] = sc.nextInt();

}

return num;

}

//method to calculate amount with tax

public static void getAmountWithTax(int num[], double rate[], double amount[])

{

double totalAmount = 0;

//find the amount for all items and totalAmount

for(int i=0; i<5; i++)

{

amount[i] = num[i]*rate[i];

totalAmount = totalAmount + amount[i];

}

//find salesTax, amountDueWithTax

salesTax = totalAmount*0.06;

amountDueWithTax = totalAmount + salesTax;

}

//method to print the receipt

public static void printInfo(int num[], String items[], double rate[], double amount[])

{

System.out.println("Thank you for visiting Roronoa Pizza Place!"); //print the title and Address

System.out.println("109th Avenue, Mount Olympia");

System.out.println("Your Order Was");

for(int i=0; i<5; i++)

System.out.printf("%d %s @ %.4f each: $%.4f\n",num[i], items[i], rate[i] ,amount[i]);

System.out.printf("Amount due for pizzas and drinks is: $%.4f\n", totalAmount);

System.out.printf("Sales tax amount is: $%.4f\n", salesTax);

System.out.printf("Total amount due, including tax is: $%.4f\n", amountDueWithTax);

System.out.printf("Amount tendered: $%.3f\n", amountTendered);

System.out.printf("Change: $%.4f\n", change);

}

//main method

public static void main(String[] args)

{

double rate[] ={8.99, 1.5, 12.99, 2.5, 1.5};

double amount[] = new double[5];

String items[] = {"Small pizzas", "Small pizza toppings", "Large pizzas", "Large pizza toppings", "Soft Drinks" };

///get all the information about items ordered

int num[] = readData(items);

//calculate amountDueWithTax

getAmountWithTax(num, rate, amount);

do{

System.out.print("Enter Amount tendered : ");

amountTendered = sc.nextDouble();

if(amountTendered >= amountDueWithTax)

break;

System.out.println ("Money given is not enough!Try again");

}while(true);

//calculate the change

change = amountTendered - amountDueWithTax;

//print the receipt

printInfo(num, items, rate, amount);

}

}

In: Computer Science

Suppose we are sorting an array of eight integers using quicksort, and we have just finished...

Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this: 2 5 1 7 9 12 11 10. What are the possible values of pivot?

Algorithm coures

In: Computer Science

C - programming problem: Let T be a sequence of an even length 2k, for some...

C - programming problem:

Let T be a sequence of an even length 2k, for some non-negative integer k. If its prefix of k symbols (or, the first k symbols in T) are the same as its suffix of k symbols (respectively, the last k symbols in T), then T is called a tandem sequence. For example, T[8] = 31103110 is a tandem sequence. Given a sequence S, if T is a subsequence of S and T is tandem, then T is called a tandem subsequence of S. One can then similarly define what a longest tandem subsequence (LTS for short) of S is.

Write a program that reads in two sequences with max length: 10,000, which computes, and prints the longest-tandem subsequence or LTS, and its length.

Sample program run:

Enter a sequence: 3110283025318292818318143

# an LTS (length = 10) for the sequence is:

1283312833

In: Computer Science

information privacy What do you think are the biggest issues facing most people? Have the boundaries...

information privacy

What do you think are the biggest issues facing most people? Have the boundaries shifted too far? Are the benefits of personalized technology worth the loss of privacy? What rights should individuals have over their data? Give examples, be specific.

In: Computer Science

Write a program to read in a collection of integer values, and find and print the...

Write a program to read in a collection of integer values, and find and print the index of the first occurrence and last occurence of the number 12. The program should print an index value of 0 if the number 12 is not found. The index is the sequence number of the data item 12. For example if the eighth data item is the only 12, then the index value 8 should be printed for the first and last occurrence.

The coding language required is Java.

In: Computer Science

Java Data Structures (Stack and Recursion) Using the CODE provided BELOW (WITHOUT IMPORTING any classes from...

Java Data Structures (Stack and Recursion)

Using the CODE provided BELOW (WITHOUT IMPORTING any classes from Java Library) modify the classes and add the following methods to the code provided below.

1. Add a recursive method hmTimes() to the CODE BELOW that states how many times a particular value appears on the stack.

2. Add a recursive method insertE() to the CODE BELOW that allows insert a value at the end of the stack.

3. Add a recursive method popLast() to the CODE BELOW that allows removal of the last node from the stack.

4. Add a recursive method hmNodes() to CODE BELOW that states how many nodes does the stack have.


Prove that every method works, MULTIPLE TIMES, in the MAIN StackWithLinkedList2.

CODE:

class Node {

  int value;

  Node nextNode;

  

  Node(int v, Node n)

  {

    value = v;

nextNode = n;

  }

  

  Node (int v)

  {

     this(v,null);

  }

}

class Stack {

  protected Node top;

  

  Stack()

  {

    top = null;

  }

  

  boolean isEmpty()

  {

    return( top == null);

  }

  void push(int v)

  {

    Node tempPointer;

    tempPointer = new Node(v);

tempPointer.nextNode = top;

top = tempPointer;

  }

  

  int pop()

  {

    int tempValue;

tempValue = top.value;

top = top.nextNode;

return tempValue;

  }   

  

  void printStack()

  {

    Node aPointer = top;

String tempString = "";

while (aPointer != null)

{

tempString = tempString + aPointer.value + "\n";

aPointer = aPointer.nextNode;

}

System.out.println(tempString);

  }

  

  boolean hasValue(int v)

  {

    if (top.value == v)

{

return true;

}

else

{

return hasValueSubList(top,v);

}

  }

  

  boolean hasValueSubList(Node ptr, int v)

  {

    if (ptr.nextNode == null)

{

return false;

}

else if (ptr.nextNode.value == v)

{

return true;

}

else

{

return hasValueSubList(ptr.nextNode,v);

}

  }

}

public class StackWithLinkedList2{

  public static void main(String[] args){

    int popValue;

    Stack myStack = new Stack();

myStack.push(5);

myStack.push(7);

myStack.push(9);

    System.out.println(myStack.hasValue(11));

  }

}

In: Computer Science

HI.... just I want the <tags> of this scenario .... Scenario-based Problem: You are assigned to...

HI.... just I want the <tags> of this scenario ....

Scenario-based Problem:
You are assigned to develop a web based Online Electronic showroom in the Sultanate of oman using HTML 5 with CSS, basic JavaScript and PHP&MySQL. The website should contain the following webpages:

  •  Homepage

  •  Sign In

  •  Sign Up

  •  About Us

  •  Product Details

  •  Feedback

  •  Contact Us

    Following are the details about each page:

    Page-1: HOMEPAGE (Design using Bootstrap)

    This page should have picture/s, background color, text/headings with suitable font with link to all other pages and CSS.

    Page-2: ABOUT US

    This page should have a brief description of the company. This should contain a paragraph with sufficient text color, formatting tags, images, links and CSS.

    Page-3 and 4:Product DETAILS

    Each page should contain Tables with column span and row span, CSS, images, formatting tags, etc. Include any video related to the topic.

    Page-5: SIGN IN (No database)

    This should contain the login form with validations using HTML5, PHP form handling, database connectivity.

    Page-6: SIGN UP

    This should contain the Registration form with validations using JavaScript, PHP form handling, database connectivity. Display the records from the table.

    Page-7: FEEDBACK (No database)

    This should contain the Feedback form with validations using HTML 5 and PHP form handling. Display the feedback.

Page-8: CONTACT US

This should contain a paragraph with sufficient text color, formatting tags, images, links, CSS etc. Note: Kindly refer to the marking scheme for more information and clarity.

In: Computer Science

C++ Question Design and implement a class that stores a list of students. Each student has...

C++ Question

Design and implement a class that stores a list of students. Each student has the list of courses he/she registered for the semester. You will need a container of containers to hold this list of students. Choose the optimal container for this exercise, noting that no duplicates should be permitted. Use STL classes with iterators to navigate the list. Develop a test program, which allows options to add, remove, and list students and their associated course lists. Also include a function that displays the first course name in each list (the function must use iterators) Please use namespace std for this.

In: Computer Science

Explan 4, 5, and 7, using a computer ? The steps for crisis management are: 1-...

Explan 4, 5, and 7, using a computer ?
The steps for crisis management are:
1- Announce and generally publicize the problem.
2- Assign responsibilities and authorities.
3- Update status frequently.
4- Relax resource constrains.
5- Have project personnel operate in burnout mode.
6- Establish a drop-dead date.
7- Clear out nonessential personnel.

In: Computer Science

In Python, generate 30 random values between 0-10 and store it in a list. Print the...

In Python, generate 30 random values between 0-10 and store it in a list. Print the list and the number of occurrences for each value from 0 to 10.

In: Computer Science

Given an array A[1..n] of integers such that A[j] ≥ A[i] − d for every j...

  1. Given an array A[1..n] of integers such that A[j] ≥ A[i] − d for every j > i. That means any inversion pair in A differs in value by at most d. Give an O(n + d) algorithm to sort this array.

In: Computer Science

When programming in the Unix/Linux shell, short-circuit evaluation of an expression is a standard way to...

  1. When programming in the Unix/Linux shell, short-circuit evaluation of an expression is a standard way to execute a second command ONLY IF the first command was successful. How does this work?

  2. What is a ternary operator? When should it be used and when should it be avoided?

  3. We perform a hand trace of a C program to validate what?

In: Computer Science