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 8012929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:29:15+00:00 2026-06-04T19:29:15+00:00

For example, say I have [7, 11, 0, 2] , I want to compare

  • 0

For example, say I have [7, 11, 0, 2], I want to compare 7 and 2, then 11 and 0.

Two ways I have done this so far by entering the positions in statements like this:
list[0] > list[list.length-1] then list[1] > list[list.length-2], I obviously don’t want to have to type all this manually as my lists get larger. Another way I tried to test how to do this was with a recursion but because my program is already running in a recursion I found it a bit confusing..so is it possible to dynamically compare items against each other without the use of a recursion?

The list size is always even and fixed for the life of the program. Any ideas?

note: If I get the idea I can implement it myself but specifically what I’m doing is comparing if each relative item is larger than the other and if they are equal then I compare the next item. For example, [1,5,3,1,5,1], I would compare 1 & 1 and since they are the same I would move to compare 5 & 5 and since they are the same I’d compare 3 & 1. Not sure if there’s a non-recusive way to do it, but thought I’d try.

  • 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-04T19:29:17+00:00Added an answer on June 4, 2026 at 7:29 pm
    for(int i=0;i<list.length/2;i++){
        if(list[i]>list[list.length-1-i]){
            //do stuff
        }
    }
    

    I had to do something similar when checking for palindromes in strings

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

Sidebar

Related Questions

Say that I have a rather large repository, and I want to compare two
Let's say I have a function like this (it's only an example, so do
We have two lists, let's say students and their scores. I want to compare
So let's say I want to compare two DOMDocument objects. They have the same
For example: I have an implementation (say doSomething()) in Base class. I want all
Lets say I want to save function in database. For example we have table
i have problem use link_to_remote link_to_remote document example say link_to_remote Delete this post, :update
Say I have this file: http://www.example.com/somepic.png Is there a cross platform C or C++
Say I have this url: http://site.example/dir/ In this folder I have these files: test.ascx.cs
Say I have a class ObjectA (a view controller for example), that does this

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.