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

  • SEARCH
  • Home
  • 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 7626587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:20:42+00:00 2026-05-31T05:20:42+00:00

Lets say – I have the two vectors: a numbers=[14 14 2 25 25

  • 0

Lets say – I have the two vectors:

a    numbers=[14 14 2 25 25 14 14 14 2 23 23 23]:
b    frequency_of_the_numbers_above=[2 1 2 3 1 3];

c    new_numbers=[14 14 14 14 14 2 2 2 2 25 25 25 25 25 25 25 14 14 14 14 14 2 2 2 2 23 23 23 23 ];

b describes how often a value in vector a appears.For example:number 14 two times, that’s why first number in b is 2 ,number 2 in vector a one time that’s why second number in vector b is 1 etc.

what I now want is to adapt the vector b to vector c so that the result should look like:

new_numbers[14 14 14 14 14 2 2 2 2 25 25 25 25 25 25 25 14 14 14 14 14 2 2 2 2 23 23 23 23 ];
frequency_numbers_for_new_numbers=[2 2 2 2 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 1 1 1 1 3 3 3 3];
  • 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-05-31T05:20:43+00:00Added an answer on May 31, 2026 at 5:20 am

    your question doesn’t seem to fit what’s in the vectors you posted. What b seems to be is how many of a given number appears in a in a ROW. As there are 5 14s in a. And your result seems to be whatever number was in b repeated for the number of that element in c is that what you want? Does a and c always contain the same numbers in the same order?

    Well I’ll write the code to do what I described (in java)

    int index = 0;
    int currentVal = c[0];
    int[] result = new int[c.length];
    
    for(int i = 0; i < result.length; i++)  {
        if(c[i] != currentVal) {
            index++; //if the number changed go to the next index for b
            currentVal = c[i]; //update the currentVal to the new value
        }
        result[i] = b[index]; //copy the value from b into the result vector
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say i have a table: <table> <tr></tr> </table> $(function(){ $('#btn').click(function(){ $('table').append('<tr><input class=remove value=remove></tr>');
Lets say I have an arbitrary vector A. What is the most efficient way
Lets say, for example, that I have a class that requires the use of
Lets say in a file I have some code in two files part of
Lets say you have two classes, Boss and Employee. There is a bidirectional many-to-many
Lets say I have an image or two dimensional pattern similar to QRcode and
lets say i have two branches master develop in master i have something like
Lets say I have a p tag like this: <div id = example> <p
Lets say I have two tables in Postgres: Name: table_rad Column Type id integer
Lets say I have a Dictionary object: Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();

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.