•Every element at an even index.
•Every even element.
•All elements in reverse order.
•Only the first and last element.
In: Computer Science
WHAT are the non-visible controls stored in Visual Studio IDE
In: Computer Science
- Delcare variable data type as decimal (5 variables needed) count, price, subtotal, tax, total
- Write a do while loop, if the price is not -1, loop continues show count number enter price get subtotal increase count
- Calculate tax, total
- Display total count, subtotal, tax, total
In: Computer Science
C++ How can I print out the subtrees in my self-balancing tree? What I would like to do is have it display something like " ROOT = X, LEFT PARENT = X, X,X, RIGHT PARENT = X,X,X.
Here is my code:
#include <iostream>
using namespace std;
class TreeNode
{
public:
int data;
TreeNode* left;
TreeNode* right;
};
TreeNode* newNode(int data);
/* A function that constructs Balanced
Binary Search Tree from a sorted array */
TreeNode* convertToBTS(int arr[],
int start, int end)
{
if (start > end)
return NULL;
//make the middle number the root
int mid = (start + end) / 2;
TreeNode *root = newNode(arr[mid]);
root->left = convertToBTS(arr, start,
mid - 1);
root->right = convertToBTS(arr, mid + 1, end);
return root;
}
/* Helper function that allocates a new node
with the given data and NULL left and right
pointers. */
TreeNode* newNode(int data)
{
TreeNode* node = new TreeNode();
node->data = data;
node->left = NULL;
node->right = NULL;
return node;
}
//The array will be sorted in PreOrder
void preOrder(TreeNode* node)
{
if (node == NULL)
return;
cout << node->data << " ";
preOrder(node->left);
preOrder(node->right);
}
int main()
{
const int SIZE = 7;
int arr[SIZE];
int count = 7, num = 0;
cout << "We will construct a Self-Balancing Tree!\n Enter 6 numbers for the nodes." << endl;
for (int i = 0; i < SIZE; i++)
{
cout << "Enter " <<
count << " more items!" << endl;
cin >> arr[i];
count--;
}
int n = sizeof(arr) / sizeof(arr[0]);
/* Convert List to BST */
TreeNode *root = convertToBTS(arr, 0, n - 1);
cout << "The tree will be displayed in
PreOrder!" << endl
<< "First number will be the
ROOT. Then LEFT SUBTREE, and RIGHT SUBTREE." << endl;
preOrder(root);
return 0;
}
In: Computer Science
Describe how the Rational User Process can accommodate agile process. Specify in what phases and what disciplines agile methods could be appropriate.
In: Computer Science
Explain why the client congestion window(cwnd) size varies differently for different load conditions. In context to tcp congestion control using aimd technique and tcp reno protocol.
In: Computer Science
Illustrate with a diagram how basic TCP Windowing works.
In: Computer Science
note: Input-output screen-shot if needed #No-copy paste codes, please.
Q) Create a python functions that rotates the elements of a list by one position. Consider a function rotate(a_list, direction) that takes as arguments the list to rotate, and the direction (left or right) of rotation. Rotate the list in place.
Q) Choice of appropriate data structure is an important step in
designing algorithms. Suppose a text file contains student records
on each line and each record is of the format: Name of Student,
Student ID, GPA. Now consider reading that le to create a list of
lists, a list of tuples or a tuple of tuples.
(a) If you want to create a report using the data, what data
structure would you use?
(b) If you want to modify the name, id or GPA, what data structure would you use?
In: Computer Science
Human computer interaction
An online air ticket reservation company is experimenting with a new interactive user interface design for its customers. Study any leading online air ticket reservation system to understand this interface and using it, give examples of any three social impact of interface design for following elements. You can use screenshots to elaborate your example.
In: Computer Science
Database Design and SQL
Consider the following relations:
Student (snum: integer, sname: string, major: string, level:
string, age: integer)
Class (name: string, meets_at: time, room: string, fid:
integer)
Enrollment (snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
Write the following queries in SQL. Also, there should be no
duplicates printed in any of the answers.
a) Find the names of all students who are enrolled in two classes
that meet at the same time.
b) Find the names of faculty members for whom the combined
enrollment of the courses that they teach is less than five.
c) Print the Level and the average age of students for that Level,
for each Level.
d) Print the Level and the average age of students for that Level,
for all Levels except JR.
e) Find the names of students who are enrolled in the maximum
number of classes.
f) Find the names of students who are not enrolled in any
class.
In: Computer Science
C Programming
The score table will be printed by reading the match information made between the teams.
It is not known how many teams. The team information will be kept in a dynamically changed memory area as the new team enters. The match list should also be kept in a dynamic area that is recorded as new match information is entered.
There should be 2 structs in the program.
Mac struct: Consists of 1st team name, 2nd team name, 1st team goal, 2nd team goal information.
Team struct: consists of team name (one word, 20), number of wins, number of draws, number of defeats, number of goals scored, number of goals eaten, point.
Example input: abc xyz 3 1 (Information will be entered completely and correctly.)
A single line of match information, with a space between them, 1 Team name, 2 Team name, 1.
The goal scored by the team will be entered as the goal scored by the 2nd team. In the case where the above example is the first match information entered for these teams, two teams will be identified in the abc and xyz names, and will be added to the team list, since there are no teams defined in these names yet. At the same time, a match struct will be defined, this match struct will be added to the match list, and all information of both teams in the team struct will be updated with this match information.
If the above example is not the first match information entered about the abc and xyz teams, since both teams will be defined before, these teams will be found in the teams list and their relevant information will be updated.
In summary, for the above entry, if the team has not yet been identified in these names, both teams will be identified and added to the team list. The number of victories of the ABC team will be increased by one, the number of goals scored will be increased by 3, the number of goals scored will be increased by 1, and the score will be increased by 3. The xyz team's number of defeats will be increased by 1, the goal scored will be increased by 1, the goal it has scored will be increased by 3, its score will be reduced by 1. (wins 3 points, draw 1 point, defeat -1 point). The match struct will be added to the match list.
After entering the match information, the scoreboard will be printed.
Scoreboard: The information in the team struct will be printed one after the other in the order given in the description. The scoreboard should be in descending order according to the score. In case of score equality, the team with a high average score (goals scored and goals scored) should be on the top. It can be assumed that the score and average will not be equal teams.
After the scoreboard is printed, the user will receive a sequence number from 1-teamnumber, and the matches of the team in the row entered will be listed. Unless -1 is entered, the sequence number will be read again after printing the information of a tool, and the program will end when -1 is entered. If a number between 1-teamnumber or an entry other than -1 has been made, an appropriate message will be given and the entry will be waited again.
In: Computer Science
Convert the following switch statement into if-else statements:
int month = input.nextInt();
switch (month) {
case 1: System.out.println(“January”);
case 2: System.out.println(“February”); break;
case 3: System.out.println(“March”); break;
case 4: System.out.println(“April”);
case 5: System.out.println(“May”); break;
default: System.out.println(“Invalid”); break;
}
example:
if (month == 1) {
System.out.println("January");
System.out.println("February"); }
if (month == 2)
{ System.out.println("February");
}
}
}
Please continue the code! Thanks
In: Computer Science
Explain what the following Scheme code is doing:
(define (make-stream n f)
(define (next m)
(cons m (lambda () (next (f m)))))
(next n))
(define head car)
(define (tail stream)
((cdr stream)))
(define (nth stream n)
(if (= n 0) (head stream)
(nth (tail stream) (- n 1))))
(define even (make-stream 0 (lambda (n) (+ n 2))))
Try it out in Scheme48 and check the values of the following expressions:
even (head even) (head (tail even)) (head (tail (tail even))) (head (tail (tail (tail even)))) (nth even 5) (nth even 1000)
Explain what the lambda in make-stream is good for, where this function is called, and how tail and nth work. To see what’s going on, trace manually through the execution of
(head (tail (tail even)))
In: Computer Science
Background: The advantage of wireless signals is that they radiate out in all directions, even penetrating walls to a certain extent. Of course, the very ability of wireless signals also causes problems.
Answer the following questions:
In: Computer Science
IN PSEUDOCODE AND JAVA SOURCE CODE PLEASE:
Program 0 (Warm-up, 40 pts): Deoxyribonucleic acid, or DNA, is comprised of four bases: (G)uanine, (C)ytosine, (A)denine and (T)hymine. Ribonucleic acid, or RNA, is different than DNA in that it contains no Thymine; thymine is replaced with something called (U)racil. For this assignment, you will create an array of 255 characters. You must start by filling the array with random characters of G, C, A and T. You must then print out the array. Next, replace all the instances of Thymine with Uracil. Finally, you must print out the array again. In your solution, you must write at least one function that contributes to the solution. You must use the length attribute of the array in your answer.
Sample run
CATGGCGTCTTGCCAAGGCGGTTCCTTGTCTTGATGATGGCTGCGAGTTCCGAGTCGCCTTTTCTATGAGTCGCGAAGTATGCGGTCAAATTATGCTTGTCCGCTGTACTAGGCCCACGGATCTCCTCAGACAGCGTCGATGTCGGAATTCGCGGGGAGGAATACTAAACATGCTGAAGTTGATACATGTACAATTGCCGCGAACCAGGTGCACAGGGTGCCCAACGATCCATGTGGAACGAGAGCGATCTAGCC
CAUGGCGUCUUGCCAAGGCGGUUCCUUGUCUUGAUGAUGGCUGCGAGUUCCGAGUCGCCUUUUCUAUGAGUCGCGAAGUAUGCGGUCAAAUUAUGCUUGUCCGCUGUACUAGGCCCACGGAUCUCCUCAGACAGCGUCGAUGUCGGAAUUCGCGGGGAGGAAUACUAAACAUGCUGAAGUUGAUACAUGUACAAUUGCCGCGAACCAGGUGCACAGGGUGCCCAACGAUCCAUGUGGAACGAGAGCGAUCUAGCC
In: Computer Science