Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The attached template deals a deck of 5 2 cards in random order into an array named udeck [ 5 2 ] ( for unsorted
The attached template deals a deck of cards in random order into an array named udeckfor unsorted deck The cards are each stored in a structure which has been typedef'ed and given the type name "card". Use the Rank Sort algorithm discussed this week to sort the cards in order. The cards are in four suits, Clubs C Diamonds D Hearts H Spades S and the suits are ordered CDHSie all Clubs are less than all Diamonds, and so forth The card ranks are through ten T Jack J Queen Q King K and Ace A and are ordered from low to high A respectively. As examples, ACD and TSJS Update the template to sort the cards in order with the Parallel Rank Sort algorithm using processors. Assigned the ordered cards to the sorted deck sdeck Display the sorted deck using the same function that displays the unsorted deck. Post your solution to this assignment as "assignc The output should look something like this:
TS S KH H H JD D AC C C QS S S
TH H KD D D JC C AS S S QH H H
TD D KC C C JS S AH H H QD D D
TC C KS S S JH H AD D D QC C C
C C C C C C C C TC JC QC KC AC
D D D D D D D D TD JD QD KD AD
H H H H H H H H TH JH QH KH AH
S S S S S S S S TS JS QS KS AS
SEQUENTIAL EXECUTION TIME:
PARALLEL EXECUTION TIME:
SPEEDUP:
NUMBER OF PROCESSORS USED: Assignment
Name:
#define DECK
#define SUITSZ
#define RANKSZ
#define APRIME
typedef struct
char suit;
char rank;
card;
char suitsSUITSZCDHS;
char ranksRANKSZTJQKA;
card udeckDECK sdeckDECK;
int comparecardscard a card b
return ;
void putinPlaceint src
card testval;
testval udecksrc;
void deal
int i m v r;
m APRIME;
v m;
for i ; i DECK; i
r v DECK;
udeckisuit suitsr RANKSZ;
udeckirank ranksr RANKSZ;
v m;
void displaycard dkDECK
int i;
for i ; i DECK; i
cout dkirank dkisuit;
if i RANKSZ RANKSZ
cout endl;
int main
int i;
cout endl;
deal;
displayudeck;
Parallel Rank Sort
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started