Given this data:
//Random Hex numbers (hint: note that form is 0x then 8 digits) (Corrected April 9, 2018) 0x6b8b45670x327b23c60x643c98690x663348730x74b0dc510x19495cff0x2ae8944a0x625558ec0x238e1f290x46e87ccd0x3d1b58ba0x507ed7ab0x2eb141f20x41b71efb0x79e2a9e30x7545e1460x515f007c0x5bd062c20x122008540x4db127f80x216231b90x1f16e9e80x1190cde70x66ef438d0x140e0f760x3352255a0x109cf92e0xded726390x7fdcc2330x1befd79f0x41a7c4c90x6b68079a0x4e6afb660x25e45d320x519b500d0x431bd7b70x3f2dba310x7c83e4580x257130a30x62bbd95a0x436c61250x628c895d0x333ab1050x721da3170x2443a8580x2d1d5ae90x6763845e0x75a2a8d40x8edbdab90x79838cb20x4353d0cd0xb03e0c690x189a769b0x54e49eb40x71f324540x2ca886110x836c40e90x2901d8290x3a95f8740x8138641n0x1e7ff5210x7c3dbd3d0x737b8ddc0x6ceaf0870x22221a700x4516dde90x3006c83e0x614fd4a10x419ac2410x5577f8e10x440badfc0x507236790x3804823e0x77465f010x7724c67e0x5c482a970x2463b9ea0x5e884adc0x51ead36b0x2d5177960x580bd78f0x153ea4380x3855585c0x70a64e2a0x6a2342ec0x2a487cb00x1d4ed43b0x725a06fb0x2cd89a320x57e4ccaf0x7a6d8d3c0x4b588f540x542289ec0x6de91b180x38437fdb0x7644a45c0x32fff9020x684a481a0x579478fe0x749abb43
Please write a code OR 3 separate codes in C-code (NOT C++) that can do the following:
1. Sort ascending
2. Sort descending
3. Frequency of occurrence
The input is the the data listed above. Separate codes may be used if necessary. The letters t and n have no significance. When listing in ascending or descending order, it does not matter if the digits, letters or symbols are listed first as long as they're in the correct order
#include <stdio.h> void frequency_counter( int arr[] , int size ) { int i, j, count , repeat[size]; for (i = 0; i < size; i++) { count = 1; for (j = i + 1; j < size; j++) { //for duplicate elements // fix one element (i) and check the remaining array for repetation if (arr[i] == arr[j]) { count++;// incremnet the frequency repeat[j] = 0; } } if (repeat[i] != 0) repeat[i] = count; } printf("\n"); printf(" Elements of array and its frequency : \n"); for (i = 0; i < size; i++) { if (repeat[i] != 0) { printf("%d repeated %d times\n", arr[i], repeat[i] ); } } } void insertionSort_dcend ( int arr[] ,int size ) { int j, temp; for (int i = 1; i < size; ++i) { j = i; while (j > 0 && arr[j-1]<arr[j]) { temp = arr[j]; arr[j] = arr[j-1]; arr[j-1] = temp; j--; } } int i = 0 ; printf( "The sorted array in decending order is : \n" ) ; for(;i<size;i++) printf("%12X (Decimal: %12d)\n",arr[i],arr[i]); } void insertionSort_accend(int *arr, int size) { int j, temp; for (int i = 1; i < size; ++i) { j = i; while (j > 0 && arr[j-1]>arr[j]) { temp = arr[j]; arr[j] = arr[j-1]; arr[j-1] = temp; j--; } } int i = 0 ; printf( "The sorted array in accending order is : \n" ) ; for(;i<size;i++) printf("%12X (Decimal: %12d)\n",arr[i],arr[i]); } int main() { int arr[]={0x6b8b4567 , 0x327b23c6, 0x643c9869, 0x66334873, 0x74b0dc51, 0x19495cff, 0x2ae8944a, 0x625558ec, 0x238e1f29, 0x46e87ccd, 0x3d1b58ba, 0x507ed7ab, 0x2eb141f2, 0x41b71efb, 0x79e2a9e3, 0x7545e146, 0x515f007c}; int size = sizeof(arr)/ sizeof(arr[0]); int i = 0 ; printf("Array elements are: \n"); for(;i<size;i++) printf("%12X (Decimal Value : %12d)\n",arr[i],arr[i]); //lets sort the numbers in accending order insertionSort_accend(arr , size ); insertionSort_dcend ( arr , size ); frequency_counter( arr , size ) ; return 0; }
Given this data: //Random Hex numbers (hint: note that form is 0x then 8 digits) (Corrected...
The second phase of your semester project is to write pass one of a two‑pass assembler for the SIC assembler language program. As with Phase 1, this is to be written in C (not C++) and must run successfully on Linux. Pass one will read each line of the source file, and begin the process of translating it to object code. (Note: it will be to your advantage to have a separate procedure handle reading, and perhaps tokenizing, the source...