Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is my third time asking this question. Please answer. In C++, create a Trie

ID: 3695819 • Letter: T

Question

This is my third time asking this question. Please answer.

In C++, create a Trie data structure which can handle the following text: "I like food". The user will enter the text. After you build the Trie, allow the user to enter a single word and determine whether or not it was in the original text. Provide 2 functions: (1) Receive the text and build the trie; (2) Receive a word and determine whether it exists within the text.

Also, include the following features in the program:

(a). Identify at what position within the text the word appears.

(b). Be able to cope with the following text: "I like fine fresh food, but only if it is fresh".

(c). Incorporate both (a) and (b).

(d). Let the user search for "fresh" and tell the user in all the places it appears.

Explanation / Answer

Machine LanguageThis is what the computer actually sees and deals with. Every command thecomputer sees is given as a number or sequence of numbers.Assembly LanguageThis is the same as machine language, except the command numbers havebeen replaced by letter sequences which are easier to memorize. Other smallthings are done to make it easier as well.High-Level LanguageHigh-level languages are there to make programming easier. Assemblylanguage requires you to work with the machine itself. High-level languagesallow you to describe the program in a more natural language. A singlecommand in a high-level language usually is equivalent to several commandsin an assembly language.In this book we will learn assembly language, although we will cover a bit of high-level languages.

Chapter 2. Computer Architecture

In addition to all of this, the Von Neumann architecture species that not onlycomputer data should live in memory, but the programs that control the computer’soperation should live there, too. In fact, in a computer, there is no differencebetween a program and a program’s data except how it is used by the computer.They are both stored and accessed the same way.

The CPU

So how does the computer function? Obviously, simply storing data doesn’t domuch help - you need to be able to access, manipulate, and move it. That’s wherethe CPU comes in.The CPU reads in instructions from memory one at a time and executes them. Thisis known as the

fetch-execute cycle

. The CPU contains the following elements toaccomplish this:

Program Counter

Instruction Decoder

Data bus

General-purpose registers

Arithmetic and logic unitThe

program counter

is used to tell the computer where to fetch the nextinstruction from. We mentioned earlier that there is no difference between the waydata and programs are stored, they are just interpreted differently by the CPU. Theprogram counter holds the memory address of the next instruction to be executed.The CPU begins by looking at the program counter, and fetching whatever numberis stored in memory at the location specied. It is then passed on to the

instructiondecoder

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote