Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:54:54+00:00 2026-06-08T22:54:54+00:00

Task is: There are 2 arrays A (numeric floating type) and B is a

  • 0

Task is:

  • There are 2 arrays A (numeric floating type) and B is a character array. A is populated with random numbers.
  • Let A[i] denote the ith value which is associated with the ith character from B array.That is, every unique Ai is mapped /associated with a unique Bi. So,if there are similar Ai’s then each one of them would be associated with the same character from B sequentially.
  • Now, there is a new array which New_A which is populated by random numbers which may be slightly different from that of A or few numbers may be exactly the same. The task is to create a character array New_B based on the following assumption :
  • We find the smallest Euclidean distance or any measure between New_A[j] and A[i] such that given a New_A[j], the character from B is assigned where A[i] >=New_A[j] (New_A[i] >= A[j]). Let small_A denote the index j of the smallest A[j] for which the condition holds.
  • For ex, say the character associated with A[2] is ‘d’ and value at A[2]=12.1 and value at New_A[7]=11.9. Because, A[2]> New_A[7],New_A[7] gets mapped/associated with the character which was initially associated with A[2] which is character ‘d’ ; the rest where this condition does not hold remain unchanged. Therefore,the overall effect/objective is to create a variation of the character array B into a new character array New_B according to New_A and A.

Now,this is where I am stuck. How to find the smallest Euclidean value and then how to assign the characters of B following the condition. Moreover,the data types of the arrays are different so how would the association be done. Usage of 2D arrays was a pure guess work and there is no guarantee that I am correct.

float A[10];
char B[10] = {'c','d','e','f','g','h','i','j','k','l'} ; 

for (i = 1; i <= 10; i++) {
  Val_A[i] = rand(); 
  Val_New[i] = rand();
  A[i] = Val_A[i]; 
  New_A[i][j] = Val_New[i]; 
}

max1 = New_A[0];
index1 = 0; 
for (i = 1; i < 10; i++) {
  if (A[i] > max1)
    extract_char = B[i];  
  New_A[i][j] = extract_char;  
  //assigning corresponding character to New_A, which was assigned earlier to A   
  index1 = i;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:54:55+00:00Added an answer on June 8, 2026 at 10:54 pm

    First of all euclidean distance for scalars is just a fancy way of saying “absolute value of the difference” e.g. fabs(a-b)

    For each element “i” in New_A:

    1. ind the element indexed “minA” in A with the smallest euclidean distance
    2. Set New_B[i] to B[minA]

    First step 1:

    int findminA(float A[], int sizeA, float compare)
    {
      int i;
      int minA=0;
      float best=abs(a[0]-compare);
      for(i=1;i<sizeA;++i) {
        if(fabs(A[i]-compare)<best) {
           best=fabs(A[i]-compare)
           minA=i;
      }
      return i;
    }
    

    This gets you the index (for A and B) that has the smallest euclidean distance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do some task. There are numbers give in two rows and
I have the following task: there are a simple table from mysql database: <html>
I thought the following would be a pretty common task and assumed there would
Is there a MSBuild task for setting custom attribute in AssemblyInfo.cs? I found AssemblyInfo
Assuming there is a task (e.g. an image processing method with a lot math)
There is a task to display an image, which is placed to a Google
Is there a way except the sshexec task to do this? I know that
is there a way to create a task/activity report (say a weekly report) off
There is a task to write a crawler to crawl the webpage by python.
Is there a way to dynamically determine whether the currently executing task is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.