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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:14:26+00:00 2026-05-25T03:14:26+00:00

We have a n*n matrix for example we take n=4 and the matrix is

  • 0

We have a n*n matrix for example we take n=4 and the matrix is given below.

 1  2  3  4
 5  6  7  8
 9 10 11 12
13 14 15 16

We have to traverse it in the sequence:

1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10

How can I do this?

  • 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-25T03:14:27+00:00Added an answer on May 25, 2026 at 3:14 am

    “Traversing” in this case probably means accessing and printing each entry.You want to go through it in a clockwise spiral, starting from the top.

    Here is an English-sentence-style description of what you need to do:

    If you can find a way to go to the TOP-LEFT element of a sub-matrix, read off the entries in the top row left-to-right, read off the entries in the right column top-to-bottom, entries in the bottom row right-to-left, and then the left column bottom-to-top, you have one iteration. You can take the remaining sub-matrix and continue until you have nothing left.

    Further hints:

    From the cell M[x][y],

    • M[x][y+1] is the cell to the RIGHT (so long as y+1<n)
    • M[x][y-1] is the cell to the LEFT (so long as y>0)
    • M[x+1][y] is the cell BELOW (so long as x+1<n)
    • M[x-1][y] is the cell ABOVE (so long as x>0)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As a simple example, let's say you have this matrix: M = [omega 1;
let's say I have a matrix (array) like this example, but much larger: 0
I have an n-partite (undirected) graph, given as an adjacency matrix, for instance this
This is something I have wondered for a long time. Take the following example:
I have a large sparse matrix representing attributes for millions of entities. For example,
This is an OpenCV2 question. I have a matrix representing a closed space curve.
There are many articles in this site regarding my question. I have a matrix
I have a matrix (5x5) with values in them for example: Matrix (1,1) Value:
I have this matrix A, representing similarities of pixel intensities of an image. For
I have a symmetric matrix like shown in the image attached below. I've made

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.