Question: THIS IS A SIMD METHOD QUESTION WITH C LANGUAGE. NOT LOOP PROGRAMMING OR BITWISE SOLUTION. SOLUTION SHOULD USE SIMD METHODS. IF YOU DONT KNOW SIMD

THIS IS A SIMD METHOD QUESTION WITH C LANGUAGE. NOT LOOP PROGRAMMING OR BITWISE SOLUTION. SOLUTION SHOULD USE SIMD METHODS. IF YOU DONT KNOW SIMD ARCHITECTURE ON C DONT ANSWER. ANSWER MUST BE IN CONSTANT TIME O(1) and DOESNT INCLUDE FOR, WHILE etc LOOP. YOU MUST USE SIMD instricts

IF YOU DONT KNOW SIMD ARCHITECTURE ON C DONT ANSWER. You are given sixty-four bit integer and wants to determine position of k'th set bit in contant time (means you cannot use any loop like while, for, foreach etc. you must solve with elegant way with one instructions and O(1) complexity) with SIMD instrict and describe your code clearly (if need you can use index scheme such as 0 base or 1 base)

you cannot use any loop like while, for, foreach etc. you must solve with elegant way with one instructions and O(1) complexity

answer is not below. you should use SIMD methods.

bool kthBit(int number,int k) { //return bitwise and of number and 1 left shifted to kth position for ans return (number &(1< 

or

while (n) {

// Check if the last

// bit is set or not

if (n & 1)

cnt++;

// Check if count is equal to k

// then return the index

if (cnt == k)

return ind;

// Check if count is equal to k

// then return the index

if (cnt == k)

return ind;

// Increase the index

// as we move right

ind++;

// Right shift the number by 1

n = n >> 1;

}

return -1;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!