1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Pavel [41]
3 years ago
8

What are search tries? Why are they more efficient than usualsearching algorithms?

Computers and Technology
1 answer:
Sati [7]3 years ago
6 0

Answer:

Trie is a tree based data structure where the keys are strings.  

Search trees are a data structures in Computer Science in which they are based on trees.

Explanation:

Search trees are tree based data structures which are used to search elements in the tree as the names suggests (search tree). However, for a tree to perform as search tree the key it has to follow specific conditions. They are , the the key of any node has to be less than the all the keys present in the right sub trees and greater than all the keys present in the left subtree.

You might be interested in
Which line in the following program will cause a compiler error? #include using namespace std; int main() { int number =5; if (n
DanielleElmas [232]

Answer:

  1. #include  <iostream>
  2. using namespace std;
  3. int main() {
  4. int number =5;
  5. if (number>=0&& number <=100){
  6.    cout<<"passed.\n";
  7. }
  8. else{
  9.    cout<<"failed.\n";
  10. }
  11. return 0;
  12. }

Explanation:

There where multiple errors in the code given in the questions

Line 1: Missing <iostream>

Line 5: The comparison operator was wrong correction is highlighted

Line 12 Missing closing brace for the main function

All the errors have been fixed and the code above compiles

4 0
2 years ago
Write a function that returns a chessboard pattern ("B" for black squares, "W" for white squares). The function takes a number N
Kryger [21]

Answer:

Here is the C++ program.

#include <iostream>  //to use input output functions

using namespace std;  // to access objects like cin cout

 

void chessboard(int N){  // function that takes a number N as parameter generates corresponding board

   int i, j;  

   string black = "B";  // B for black squares

   string white = "W"; // W for white squares

   for(i=1;i<=N;i++){  //iterates through each column of the board

       for(j=1;j<=N;j++){  //iterates through each row of the board

           if((i+j)%2==0)  // if sum of i and j is completely divisible by 2

               cout<<black<<" ";  //displays B when above if condition is true

           else  //if (i+j)%2 is not equal to 0

           cout<<white<<" ";  }  // displays W when above if condition is false

      cout<<endl;    }    }  //prints the new line

       

int main(){    //start of the main function

   int num;  //declares an integer num

   cout << "Enter an integer representing the size of the chessboard: ";  //prompts user to enter size of chess board

   cin >> num;  //reads value of num from user

   chessboard(num); } //calls chessboard function to display N lines consist of N space-separated characters representing the chessboard pattern

Explanation:

The function works as follows:

Lets say that N = 2

two string variables black and white are declared. The value of black is set to "B" and value of white is set to "W" to return a chessboard pattern in B and W squares.

The outer loop for(i=1;i<=N;i++) iterates through each column of the chess board. The inner loop  for(j=1;j<=N;j++) iterates through each row of chess board.

At first iteration of outer loop:

N = 2

outer loop:

i=1

i<=N is true because i=1 and 1<=2

So the program enters the body of the outer for loop. It has an inner for loop:

for(j=1;j<=N;j++)

At first iteration of inner loop:

j = 1

j<=N is true because j=1 and 1<=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(1+1) % 2 == 0

(1+1 )% 2 takes the mod of 1+1 with 2 which gives the remainder of the division.

2%2 As 2 is completely divisible by 2 so 2%2 == 0

Hence the if condition evaluates to true. So the statement in if part executes:

cout<<black<<" ";

This prints B on the output screen with a space.

B

The value of j is incremented to 1.

j = 2

At second iteration of inner loop:

j = 2

j<=N is true because j=2 and 2=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(1+2) % 2 == 0

(1+2 )% 2 takes the mod of 1+2 with 2 which gives the remainder of the division.

3%2 As 3 is not completely divisible by 2

Hence the if condition evaluates to false. So the statement in else part executes:

cout<<white<<" ";

This prints W on the output screen with a space.

B W

The value of j is incremented to 1.

j = 3

Now  

j<=N is false because j=3 and 3>2

So the loop breaks and program moves to the outer loop to iterate through the next row.

At second iteration of outer loop:

N = 2

outer loop:

i=2

i<=N is true because i=2 and 2 = 2

So the program enters the body of the outer for loop. It has an inner for loop:

for(j=1;j<=N;j++)

At first iteration of inner loop:

j = 1

j<=N is true because j=1 and 1<=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(2+1) % 2 == 0

(2+1 )% 2 takes the mod of 2+1 with 2 which gives the remainder of the division.

3%2 As 3 is not completely divisible by 2

Hence the if condition evaluates to false. So the statement in else part executes:

cout<<white<<" ";

This prints W on the output screen with a space.

B W

W

The value of j is incremented to 1.

j = 2

At second iteration of inner loop:

j = 2

j<=N is true because j=2 and 2=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(2+2) % 2 == 0

(2+2 )% 2 takes the mod of 2+2 with 2 which gives the remainder of the division.

4%2 As 4 is completely divisible by 2 so 4%2 == 0

Hence the if condition evaluates to false. So the statement in if part executes:

cout<<black<<" ";

This prints B on the output screen with a space.

B W

W B

The value of j is incremented to 1.

j = 3

Now  

j<=N is false because j=3 and 3>2

So the loop breaks and program moves to the outer loop. The value of outer loop variable i is incremented to 1 so i = 3

N = 2

outer loop:

i=3

i<=N is false because i=3 and 3>2

So this outer loop ends.

Now the output of this program is:

B W

W B

Screenshot of this program along with its output is attached.

8 0
2 years ago
Ok so um does anyone know how i can use a divided by sign on computer?
Maslowich
You can just put “/“ to represent dividing
6 0
3 years ago
Read 2 more answers
Which statement best describes the concept of usability?
nordsb [41]

Usability emphasizes utility over aesthetics  statement best describes the concept of usability.

B.  Usability emphasizes utility over aesthetics.

<u>Explanation:</u>

Usability mainly speaks about the utility of an item. There are many wastes created in home and work place and those are sometimes thrown without knowing that it can be re-used for another purpose.

It is always better to re-use the product without considering aesthetic aspects though aesthetic is equally important. We can make the old objects to create a new one.

There are many videos in the social media to make the old objects to be used as a sub-product to create a new object and sometimes it looks better than an old one.

4 0
3 years ago
Read 2 more answers
Microwave transmits information between network nodes using
tekilochka [14]

Answer:

Towers and satellite.

Explanation:

Electromagnetic waves is a propagating medium used in all communications device to transmit data (messages) from the device of the sender to the device of the receiver.

Generally, the most commonly used electromagnetic wave technology in telecommunications is radio waves.

Radio waves can be defined as an electromagnetic wave that has its frequency ranging from 30 GHz to 300 GHz and its wavelength between 1mm and 3000m. Therefore, radio waves are a series of repetitive valleys and peaks that are typically characterized of having the longest wavelength in the electromagnetic spectrum.

Basically, as a result of radio waves having long wavelengths, they are mainly used in long-distance communications such as the carriage and transmission of data.

The distance from one peak to the next peak is called wavelength. This distance is also equal to the distance from one trough of a wave to another.

Also, microwave is a form of radio waves which typically has short wavelengths and frequency ranging from 300 MHz and 300 GHz.

Hence, microwave transmits information between network nodes using towers and satellite.

7 0
2 years ago
Read 2 more answers
Other questions:
  • When enter a function or formula in a cell, which is the character you must type?
    14·1 answer
  • What were the goals of the “paperless society” ideal?
    14·2 answers
  • For which of the following careers is technology’s connectivity factor most important?
    13·2 answers
  • What are the characteristics of good blogs?
    8·1 answer
  • .In Python, comments begin with the comment marker and continue ______.
    14·1 answer
  • Your computer system is a participant in an asymmetric cryptography system. You've crafted a message to be sent to another user.
    13·1 answer
  • Choose the best type of loop for each situation.
    6·1 answer
  • What is the scope of numC?
    8·2 answers
  • Einstein's famous equation states that the energy in an object at rest equals its mass times the squar of the speed of light. (T
    6·1 answer
  • Is there a way for me to play a .mp3 file from my computer using Atom?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!