Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

****IN C++**** ****REPOST HOPING IT WILL GET ANSWERED**** ****DO NOT COPY THE (WRONG) SOLUTION THAT IS ALREADY ON THE SITE.**** Algorithm to Interleave the first

****IN C++****

****REPOST HOPING IT WILL GET ANSWERED****

****DO NOT COPY THE (WRONG) SOLUTION THAT IS ALREADY ON THE SITE.****

Algorithm to Interleave the first half of the queue with second half

My Encoding Algorithm

Following are the steps used to encode a list of words: 1. Push the first half elements of queue to stack. 2. Enqueue back the stack elements. 3. Dequeue the first half elements of the queue and enqueue them back. 4. Again push the first half elements into the stack. 5. Interleave the elements of queue and stack.

I have an encode data file (a text file of words) that I need decoded. The algorithm I used to encode the data is shown above. Your problem, to decode the encoded data. The input will be a txt file of words which consists of a list of words that have been encoded as described above. Write a program to input the txt file and print out the decoded results.

Restrictions: You must use aggregate Stack and Queue class. To solve this problem, you can have ONE Queue and ONE Stack and only one of each. The input data will be loaded into a Queue to start with and from the Queue start your algorithm to decode the text. (Decoding as you read in your data will not be acceptable.)

loop cin >> str; yourqueue.enqueue(str); endloop

---------------------------------------------------------------------------------------------------------

Input file: ("QStkInput.txt")

Taylor Wenner marie 999-3255 939-1512 Hoos james R. wilis Dadie thomas 818-3821 261-8342 Chipoff Hewy E Lewy Oblock Dewy 773-4152 623-9921 Booger Stone Runs Rock 822-7724 544-2372 Smelly lea Tau high 707-7281 lee Tobe 266-8324 Ore stephens Knott reynolds 613-2414 696-9231 Bee mack Yond russell Lawz 123-1234 634-2454 Lewis Tyson Michelle Chicken Tee 602-3152 828-2148 TooB john OrNot marshall 283-5214 888-2891 SixOne Mister Other Rogers 843-2343 924-7221 Joe Hasey Mac Moe Nificant Toe 430-1094 823-8000 Big Snow Tow White 384-5624 111-9999 Juan O Legged E 882-6246 Vey Tau 177-1423 Jam Twoseeor 532-6871 knocksee Zeventh 823-8321 Heaven Legg 834-2563 T. Man 587-2839 Oh Oozey Mann Znot 313-7422 Noz E 531-4353 Lec Pos Shaun Twobe 709-7424 So Sticky 840-9933 Finger Hofstra McRidder M. 829-9853 601-3225 Mighty Malioneyh Mouse P. 222-2222 J. G 287-4344 P Morier Morier G. 832-4562 E. Knot 544-2319 Yet Cray Dun Z. 732-2452 Cyco Six 134-7242 One Hauser Another Yauser 829-8221 606-2940 Pha Hack See N Doe Zakkers 243-9233 231-4449 Lu LessGo C Eat Kant 233-1984 247-7345 Fanny Thor Pac Thumb Jac 833-6391 842-3242 Big Trigger I Phanger KanC 421-3435 878-0129 Sid Knot MacGriddy Dun 882-2424 Uet R 729-5223 Wee Ah Phinish C 745-8432 Mowtoe Jimmy 334-8294 Jones Cant 382-4413 B Currie Leave W. 284-5762 D. Lase 701-4281 Won Antoney 928-2824

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions