Sunday, July 26, 2026

The Algorithmic Crucible: Why Competitive Programming is Essential for CSE Students

The Algorithmic Crucible: Why Competitive Programming is Essential for CSE Students

Walk into any university computer science department, and you will find a sharp divide. On one side, students who view Competitive Programming (CP) as the ultimate benchmark of coding prowess. On the other, those who argue it is an abstract sport with little relevance to building real-world software like mobile applications, REST APIs, or automated deployment pipelines.

Having evaluated countless algorithms both in academic settings and in production codebases, I want to bridge this gap. What is the actual ROI of grinding LeetCode, Codeforces, or HackerRank for a Computer Science and Engineering (CSE) student?


1. The Shift from "Working Code" to "Optimal Code"

In standard academic coursework, the goal is often simply to make the program work. If a student writes an $O(N^2)$ algorithm for a dataset of 100 items, the code compiles, the tests pass, and they get an A.

Competitive programming aggressively breaks this habit. When a platform throws a dataset of $N = 10^5$ at that same algorithm, it results in a brutal Time Limit Exceeded (TLE). CP forces the brain to immediately evaluate the mathematical constraints of a problem before writing a single line of code. You learn to instinctively map constraints to complexities: seeing $N = 10^5$ instantly tells you that your solution must be bounded by $O(N \log N)$ or $O(N)$. This translates directly to backend engineering, where a poorly optimized database query can crash a web server under load.

2. Edge Case Conditioning and Defensive Programming

Software engineers spend a significant portion of their time debugging edge cases. What happens if the array is empty? What if all elements are negative? What if the integer overflows a 32-bit boundary?

In CP, failing to account for an edge case results in a Wrong Answer (WA). Over time, competitive programmers develop a hyper-awareness of boundary conditions. This psychological conditioning creates developers who write highly defensive, resilient code. When you are configuring complex deployment pipelines or handling asynchronous state management in a mobile app, this ability to predict the "unhappy paths" saves hundreds of hours of production debugging.


3. Advanced Data Structure Fluency

Most CSE curriculums teach Trees, Graphs, and Hash Maps. However, knowing how a Segment Tree works in theory is very different from deploying one to solve a range-query problem under a 2-second time limit.

Data Structure CP Application Industry Translation
Tries (Prefix Trees) String manipulation, XOR maximums Search engine autocompletion, network routing
Disjoint Set (Union-Find) Cycle detection, dynamic connectivity Image processing, clustering algorithms in ML
Priority Queues (Heaps) Dijkstra’s algorithm, dynamic median Task scheduling, load balancing in servers

4. The "Big Tech" Interview Reality

We cannot ignore the pragmatic reason for CP: career trajectory. The technical interview loops for FAANG and top-tier global tech companies are heavily indexed on algorithmic problem solving. A strong background in CP essentially trivializes the standard technical interview. It allows the candidate to bypass the stress of the algorithmic round and focus on demonstrating communication skills and systems design knowledge.


The Caveat: CP is Not Software Engineering

As a professor and a practitioner, I must offer a crucial warning: Competitive programming is not a substitute for software engineering.

CP code is often written to be disposable—it is a script designed to run once, output a result, and terminate. Variables are named x, y, and z. Everything is crammed into a single file.

Real-world software engineering requires:

  • Designing maintainable, scalable architectures (like MVC or MVVM).
  • Writing clean, documented, and testable code.
  • Collaborating via Git and managing CI/CD pipelines.
  • Navigating complex frameworks, database migrations, and client requirements.

The Verdict

For a CSE student, competitive programming is like lifting weights for an athlete. A football player doesn't bench press on the field during a game, but the raw strength built in the gym makes them a vastly superior player. Treat CP as your algorithmic gym. Build your analytical strength there, but ensure you also step onto the field by building real projects, engaging in code reviews, and mastering modern development frameworks.

How much time do you allocate between competitive programming and project building? Share your thoughts and strategies in the comments below.

Deep Dive into Breadth-First Search (BFS): Graph Theory & Python Implementation

Deep Dive into Breadth-First Search (BFS): Graph Theory and Pragmatic Implementation

As both an educator and a software engineer, I often see students and developers treat graph traversal algorithms as mere academic exercises. However, understanding the topological mechanics of Breadth-First Search (BFS) is critical for designing scalable systems—from state management in mobile architectures to optimizing web crawler pipelines.

Today, we are taking an in-depth look at BFS. We will bridge the gap between formal graph theory and production-grade engineering, examining the mathematics, the algorithmic complexity, and the memory management trade-offs.


1. The Theoretical Foundation

In graph theory, we define a graph mathematically as $G = (V, E)$, where $V$ represents a set of vertices (nodes) and $E$ represents a set of edges connecting them. BFS is a traversal algorithm that explores the graph's state-space tree level by level.

Instead of aggressively plunging into the depth of a graph (as Depth-First Search does), BFS radiates outward from a source vertex $s$. It discovers all vertices at distance $k$ from $s$ before discovering any vertices at distance $k + 1$. This specific frontier-expansion mechanism is why BFS inherently computes the shortest path in an unweighted graph.

2. Algorithmic Mechanics and The Queue

The operational core of BFS is a Queue—a First-In-First-Out (FIFO) data structure. The algorithm maintains a "frontier" of nodes. As a node is dequeued, its adjacent, unvisited neighbors are enqueued.

The Critical Engineering Nuance: Queue Choice

A common mistake in Python implementations is using a standard list as a queue and calling pop(0). From a systems perspective, a standard array-backed list requires shifting all subsequent elements in memory when the first element is removed. This turns an $O(1)$ operation into an $O(N)$ operation, inadvertently degrading the entire algorithm's time complexity to $O(|V|^2)$.

In production, we must use a double-ended queue (like Python's collections.deque), which is implemented as a doubly linked list, ensuring $O(1)$ time complexity for both appends and pops.


3. Production-Grade Implementation (Python)

Below is a robust, type-hinted implementation using an adjacency list and a proper deque object.


from collections import deque
from typing import Dict, List, Set, Any

def bfs_optimal(graph: Dict[Any, List[Any]], start_node: Any) -> None:
    """
    Executes a Breadth-First Search on a graph.
    
    Args:
        graph: Adjacency list representation of the graph.
        start_node: The vertex from which traversal begins.
    """
    # Use a Set for O(1) lookups. Lists have O(V) lookup time.
    visited: Set[Any] = set([start_node])
    
    # Initialize a double-ended queue for O(1) popleft operations
    queue: deque = deque([start_node])

    while queue:
        # O(1) operation
        current_node = queue.popleft()
        print(current_node, end=" -> ")

        # Iterate through adjacent vertices
        for neighbor in graph.get(current_node, []):
            if neighbor not in visited:
                visited.add(neighbor)
                queue.append(neighbor)
                
# Define the graph G = (V, E)
adjacency_list = {
    'A': ['B', 'C'],
    'B': ['D', 'E'],
    'C': ['F'],
    'D': [],
    'E': ['F'],
    'F': []
}

print("Initiating Level-Order Traversal:")
bfs_optimal(adjacency_list, 'A')
print("END")

4. Complexity Analysis (Big-O)

Time Complexity: $O(|V| + |E|)$
In an adjacency list representation, the algorithm visits every vertex ($V$) exactly once and examines every edge ($E$) exactly once. Note: If you use an Adjacency Matrix instead, the time complexity degrades to $O(|V|^2)$ because you must scan an entire row of length $V$ for every vertex.

Space Complexity: $O(|V|)$
The memory footprint is determined by the maximum size of the queue. In the worst-case scenario (a highly branched tree or a star graph), the queue will hold all the leaf nodes simultaneously. For a tree, this width is roughly $|V|/2$, dropping the constant gives us $O(|V|)$.


5. Advanced Use Cases in Software Architecture

Beyond simple traversals, BFS is the algorithmic engine behind several complex computational tasks:

  • Edmonds-Karp Algorithm: BFS is used to find the shortest augmenting paths in flow networks to compute the maximum flow.
  • Garbage Collection (Cheney's Algorithm): Used in memory management, BFS efficiently traverses object references to separate live objects from garbage, avoiding the deep recursion stack overflows that DFS might cause.
  • Bipartite Graph Checking: By attempting to color a graph using two alternating colors layer by layer, BFS can determine if a graph is bipartite in linear time.
  • Peer-to-Peer Networks (BitTorrent): BFS logic is used to broadcast data packets to neighboring nodes efficiently without routing loops.

6. The Engineering Trade-offs: BFS vs. DFS

While BFS guarantees finding the shortest path, it comes with a structural cost:

Metric BFS DFS
Memory Overhead High. Stores entire frontier ($O(|V|)$ width). Low. Stores only the current path ($O(d)$ depth).
Cache Locality Poor. Jumps horizontally across memory references. Excellent. Follows pointers sequentially downward.
Best For... Shortest path, level-order mapping. Topological sorting, cycle detection, deep search.

Final Thoughts

Understanding when to deploy BFS over DFS is a hallmark of strong systems design. If the target is close to the source, or if you need the absolute shortest sequence of operations (unweighted), BFS is your tool. However, if memory constraints are strict, or if the target is buried deep within a dense graph, alternative heuristics or bounded depth-first approaches might be required.

What are your preferred methods for optimizing graph traversals in your tech stack? Drop a comment below to discuss.

Friday, July 24, 2026

Flutter vs React Native: Which Cross-Platform Framework Should You Choose in 2026?

 If you're planning to build a mobile app in 2026, chances are you've narrowed your options down to Flutter and React Native. Both frameworks let developers create apps for Android and iOS from a single codebase, saving time and development costs.

But which one is the better choice?

The answer depends on your project, your team's experience, and your long-term goals. Let's compare the two frameworks in the areas that matter most.

What is Flutter?

Flutter is Google's open-source UI toolkit. It uses the Dart programming language and comes with its own rendering engine, allowing developers to create highly consistent and visually appealing applications across platforms.

Flutter is known for smooth animations, customizable widgets, and excellent performance.

What is React Native?

React Native is an open-source framework created by Meta. It allows developers to build mobile applications using JavaScript or TypeScript with React.

Instead of drawing every UI element itself, React Native communicates with native platform components, making it a great choice for teams already familiar with React.


Performance

Flutter generally offers better performance because it compiles directly to native code and renders its own interface. This results in smoother animations and more consistent performance across devices.

React Native also performs well, especially for typical business applications, but very complex animations or graphics-intensive apps may require additional optimization.

Winner: Flutter


Learning Curve

If you're already experienced with JavaScript or React, React Native is easier to learn.

Flutter requires learning Dart, which is relatively simple but still another language to master.

Winner: React Native


User Interface

Flutter provides a rich collection of built-in widgets that make it easy to create beautiful, consistent interfaces.

React Native relies more on native components, giving apps a platform-specific look and feel with less customization out of the box.

Winner: Flutter


Development Speed

Both frameworks support Hot Reload, allowing developers to see changes almost instantly.

React Native benefits from the massive JavaScript ecosystem, while Flutter offers many official packages and excellent tooling.

For experienced developers, productivity is high with both.

Winner: Tie


Community and Ecosystem

React Native has been around longer and benefits from the enormous JavaScript and React communities.

Flutter's community has grown rapidly, and most common packages are actively maintained.

Winner: React Native (slightly)


Maintenance

Flutter's ecosystem is more consistent because Google controls much of the framework and widget library.

React Native projects sometimes require extra attention when updating dependencies or integrating native modules.

Winner: Flutter


Best Use Cases

Choose Flutter if you:

  • Want highly polished UI and animations
  • Need consistent design across Android and iOS
  • Are building a startup MVP
  • Plan to support desktop or web in the future
  • Value predictable performance

Choose React Native if you:

  • Already know React or JavaScript
  • Have a web development team using React
  • Need to share knowledge across web and mobile
  • Want access to the vast JavaScript ecosystem

Quick Comparison




Final Verdict

There is no universal winner because both frameworks are mature and capable.

If your priority is performance, modern UI, and long-term consistency, Flutter is an excellent choice.

If your team already works with React and JavaScript, React Native can help you move faster with familiar tools.

Ultimately, the best framework is the one that aligns with your team's skills, project requirements, and future maintenance plans—not just the latest trend.

AI in Software Development: Pros and Cons (2026 Guide for Developers)

Artificial Intelligence (AI) has become one of the biggest talking points in software development. Whether you're a student writing your first "Hello, World!", a freelancer building client projects, or a senior software engineer leading a team, you've probably used an AI tool like ChatGPT, GitHub Copilot, Claude, or Gemini.

But with all the excitement comes an important question:

Is AI making developers more productive, or is it slowly replacing them?

The truth lies somewhere in the middle.

The Advantages of AI in Software Development

1. Faster Development

AI can generate boilerplate code, create APIs, write database queries, and even build complete UI components in seconds. Tasks that previously took hours can now be completed much faster.

This doesn't mean developers become unnecessary—it means they spend less time on repetitive work and more time solving real problems.

2. Better Learning Experience

For beginners, AI acts like a patient tutor.

Instead of spending hours searching forums, developers can ask questions, request examples, or get explanations tailored to their level of understanding.

Learning technologies like Flutter, React, Python, or .NET has become much more approachable.

3. Improved Code Quality

Modern AI tools can help:

  • Detect bugs
  • Suggest optimizations
  • Recommend best practices
  • Explain complex code
  • Generate unit tests
  • Review pull requests

While AI isn't perfect, it often catches mistakes before they become costly.

4. Increased Productivity

Many software engineers report saving several hours each week by using AI for:

  • Documentation
  • Writing SQL queries
  • API integration
  • Refactoring code
  • Debugging
  • Writing regular expressions

These time savings allow developers to focus on architecture, business logic, and user experience.

5. Better Documentation

Let's be honest—most developers don't enjoy writing documentation.

AI can generate:

  • README files
  • API documentation
  • Code comments
  • User guides
  • Technical documentation

Good documentation makes projects easier to maintain and onboard new team members.


The Disadvantages of AI in Software Development

1. AI Can Be Wrong

One of the biggest risks is trusting AI blindly.

AI may generate code that:

  • Doesn't compile
  • Contains security vulnerabilities
  • Uses outdated libraries
  • Ignores business requirements
  • Produces inefficient algorithms

Always review AI-generated code before deploying it.

2. Reduced Problem-Solving Skills

If developers rely on AI for every challenge, they may stop thinking critically.

Programming isn't just about writing code—it's about analyzing problems and designing solutions.

Overdependence on AI can weaken these essential skills over time.

3. Security Risks

Sharing confidential code or sensitive business logic with AI services may violate company policies or compliance requirements.

Organizations should establish clear guidelines for using AI responsibly.

4. Lack of Context

AI doesn't fully understand:

  • Company goals
  • Business rules
  • User expectations
  • Team conventions
  • Long-term architecture

It generates responses based on patterns, not true understanding.

That's why human oversight remains essential.

5. Job Market Changes

AI is changing the hiring landscape.

Companies now expect developers to:

  • Use AI effectively
  • Deliver faster
  • Learn new technologies quickly
  • Solve more complex problems

Rather than replacing skilled developers, AI is increasing the expectations placed on them.


Skills That AI Cannot Easily Replace

Despite rapid advancements, some skills remain uniquely human:

  • System architecture
  • Product thinking
  • Communication
  • Leadership
  • Creative problem-solving
  • Client interaction
  • Understanding business needs
  • Making engineering trade-offs

These abilities become even more valuable in an AI-powered world.


Best Practices for Using AI

Here are a few practical tips:

  • Treat AI as an assistant, not an authority.
  • Verify every important piece of generated code.
  • Learn the fundamentals before relying on AI.
  • Protect sensitive company information.
  • Continue improving your programming and communication skills.

The developers who thrive won't be those who avoid AI—they'll be the ones who know when to trust it and when to question it.


Final Thoughts

AI is transforming software development at an incredible pace. It helps developers work faster, learn more efficiently, and automate repetitive tasks. At the same time, it introduces new challenges related to accuracy, security, and overreliance.

The future isn't AI versus developers.

It's developers who use AI effectively versus those who don't.

As software engineering continues to evolve, the most successful professionals will combine strong technical fundamentals with the smart use of AI tools. In that sense, AI isn't replacing developers—it's changing what it means to be a great one.

#cfsolv

----------------

Md Rahat
Software Engineer(App),

NECX Inc.

Sunday, January 5, 2025

Mobile App Development & It's Importance

Mobile App Development: The Future of Technology

In today’s fast-paced digital world, mobile app development has become one of the most crucial aspects of businesses, startups, and entrepreneurs. The rise of smartphones has significantly changed the way we interact with the world. Mobile apps offer a streamlined way to engage with customers, enhance business processes, and even build personal brand experiences. Let’s dive into the world of mobile app development and explore how it can take your business to new heights.

Why Mobile Apps Matter?

Mobile applications are not just about providing convenience—they are a direct way to reach your audience. With millions of mobile users worldwide, having a mobile app can dramatically increase your visibility, user engagement, and profitability. Whether it’s for e-commerce, entertainment, or social media, apps can fulfill a wide variety of business needs.

Some of the key reasons why mobile app development is important include:

  • Increased User Engagement: Mobile apps offer faster access to services and features, providing a more direct user experience.
  • Improved Brand Recognition: A well-designed mobile app helps increase brand visibility.
  • Better Customer Service: Apps make it easier for customers to interact with your business, resolve issues, and provide feedback.
  • Data Collection & Analytics: Mobile apps allow businesses to collect valuable customer data and provide insights to improve services and products.

PNC Soft Tech: Your Trusted Mobile App Development Partner

PNC Soft Tech is a software company that specializes in developing high-quality web and mobile applications. They understand the intricacies of app development, whether it’s for business or personal use. With their expertise, they create apps that enhance user experience, boost brand recognition, and streamline business operations.

Visit PNC Soft Tech to explore how their mobile app development services can help elevate your business to the next level. You can also reach out to them directly via WhatsApp at +8801793278360.

The Mobile App Development Process

Developing a mobile app involves several stages, from ideation and planning to design, development, and finally, deployment. Below are the essential steps involved:

  1. Idea and Conceptualization: Before development, it’s crucial to outline the goals, target audience, and features of the app. A strong idea forms the foundation for a successful app.
  2. Designing the User Interface (UI): A user-friendly interface is critical for success. The design should be intuitive, clean, and engaging to ensure a pleasant user experience.
  3. Development: This stage involves writing the actual code for the app. The development can be divided into:
    • Frontend Development: This is the part of the app that users interact with. It includes the design elements and user flow.
    • Backend Development: This deals with the server-side components and databases that power the app’s features.
  4. Testing: After development, it’s essential to test the app for bugs and issues. Quality assurance ensures the app functions smoothly across devices.
  5. Launch and Maintenance: Once the app is tested and ready, it’s time for deployment to app stores. Even after launch, apps need continuous updates and maintenance to improve functionality and keep up with evolving technologies.

PNC Soft Tech: Quality Web & Mobile Applications

Looking to build your own mobile app? PNC Soft Tech provides professional mobile app development services designed to create solutions that are not only functional but also scalable. Their team has experience working with both iOS and Android platforms, ensuring that your app reaches a wider audience.

Check out PNC Soft Tech to learn more about their offerings, or get in touch with them via WhatsApp at +8801793278360 for a consultation.

Trends in Mobile App Development

With the tech world constantly evolving, mobile app development trends also change. Staying up-to-date with the latest trends can help businesses create innovative apps that stand out. Some of the latest trends in mobile app development include:

  • Artificial Intelligence & Machine Learning: AI and ML are being integrated into mobile apps to enhance user experiences, such as personalized recommendations and intelligent chatbots.
  • Augmented Reality (AR) & Virtual Reality (VR): AR and VR are revolutionizing mobile gaming and retail apps, offering immersive experiences.
  • Cross-Platform Development: Frameworks like Flutter and React Native allow developers to build apps for both iOS and Android, saving time and resources.
  • 5G Connectivity: With the rollout of 5G networks, apps will become faster and more capable of handling complex tasks, including high-quality video streaming and gaming.

PNC Soft Tech: Innovating the Future of Mobile Apps

PNC Soft Tech is committed to delivering high-performance mobile applications with cutting-edge technology. Whether you're looking to develop an app for your business or a personal project, they offer tailored solutions to meet your specific needs.

Visit PNC Soft Tech to get started or contact them through WhatsApp at +8801793278360 for further inquiries.

Conclusion

Mobile app development is a key factor in how businesses connect with their customers. By understanding the development process and embracing the latest trends, companies can create apps that engage users and drive business growth. With the help of trusted developers like PNC Soft Tech, you can bring your app ideas to life and make a lasting impact in the mobile space.

Explore the services offered by PNC Soft Tech to create high-quality web and mobile applications for your business today!

Sunday, June 25, 2023

DFS (Depth-First Search) Algorithm Code in C/C++

Depth-First Search (DFS) is a graph traversal algorithm that explores vertices or nodes of a graph in depth before visiting the neighboring vertices. It starts at a given vertex and systematically explores as far as possible along each branch before backtracking.

The DFS algorithm follows these steps:

  1. Start by selecting a source vertex to begin the traversal.

  2. Mark the source vertex as visited and process it. This may involve performing a specific action on the vertex, such as printing its value.

  3. Explore an unvisited neighbor of the current vertex. If there are multiple unvisited neighbors, select one of them arbitrarily.

  4. Repeat step 3 recursively for the chosen neighbor. Mark it as visited and process it.

  5. If there are no unvisited neighbors, backtrack to the previous vertex (i.e., return from the recursive call).

  6. Repeat steps 3-5 until all vertices have been visited.

DFS can be implemented using recursion or a stack data structure. The recursive implementation uses the call stack implicitly to keep track of the visited vertices and backtracks when necessary. The iterative implementation, using a stack, simulates the call stack explicitly.

DFS is useful for various graph-related problems, such as finding connected components, detecting cycles, performing topological sorting, and solving maze problems.

It's important to note that DFS doesn't guarantee the shortest path between two vertices. It may traverse long paths before exploring shorter ones. If a complete traversal of all vertices is required, DFS can ensure that every vertex is visited exactly once.

However, in the case of a disconnected graph, it's necessary to apply DFS to each unvisited vertex to cover all components.

Overall, DFS is a fundamental graph traversal algorithm that provides a way to explore and analyze graphs in a systematic manner.

#include <stdio.h> #define MAX_NODES 100 int visited[MAX_NODES]; int adjacencyMatrix[MAX_NODES][MAX_NODES]; int numNodes; void initialize() { int i, j; for (i = 0; i < MAX_NODES; i++) { visited[i] = 0; for (j = 0; j < MAX_NODES; j++) { adjacencyMatrix[i][j] = 0; } } } void addEdge(int startNode, int endNode) { adjacencyMatrix[startNode][endNode] = 1; adjacencyMatrix[endNode][startNode] = 1; } void depthFirstSearch(int currentNode) { int i; printf("%d ", currentNode); visited[currentNode] = 1; for (i = 0; i < numNodes; i++) { if (adjacencyMatrix[currentNode][i] == 1 && visited[i] == 0) { depthFirstSearch(i); } } } int main() { int i, j; int startNode; printf("Enter the number of nodes: "); scanf("%d", &numNodes); initialize(); printf("Enter the adjacency matrix:\n"); for (i = 0; i < numNodes; i++) { for (j = 0; j < numNodes; j++) { scanf("%d", &adjacencyMatrix[i][j]); } } printf("Enter the starting node: "); scanf("%d", &startNode); printf("DFS traversal starting from node %d: ", startNode); depthFirstSearch(startNode); return 0; }



By Md. Rahat (CSE, BU)

Tuesday, August 20, 2019

Codeforces Solution 71A Way Too Long Words || Codeforces Solution 71A in C language

In this section , I am gonna give you the source code of the codeforces solution of the problem 71A  Way Too Long Words.
Problem Name: Way Too Long Words
Online Judge: Codeforces.com
The below given code is written in C language. :

  1. #include<stdio.h>
  2. #include<ctype.h>
  3. int main(){
  4. int n,i,m;
  5. char x[6000];
  6. scanf("%d",&n);
  7. for(i=1;i<=n;i++){
  8. scanf("%s",&x);
  9. int l=strlen(x);
  10.  
  11. if(l>10){
  12.  
  13. printf("%c",x[0]);
  14. printf("%d",l-2);
  15. printf("%c\n",x[l-1]);
  16.  
  17. }
  18. else printf("%s\n",x);}
  19. return 0;
  20. }



In python (basically Python 3) Language , the solution should be :

  1. i=input
  2. for _ in [0]*int(i()):
  3. s=i();l=len(s)-2;print([s,s[0]+str(l)+s[-1]][l>8])





Tuesday, August 7, 2018

Codeforces Problems Solution 226A - Stones on the Table

Hi friends, I am going to post the solve of the problem '226A - Stones on the Table' of Codeforces.
The problem screenshots is given below:

Code:

Codeforces Problems' Solution (339A - Helpful Maths)




The solution of the problem is given below:


#include <stdio.h>
#include <string.h>
int main ()
{
      char s[1000];
      int i, j = 0, k, l, ln, arr[1000], m, n, temp;
      scanf("%s", s);
      ln = strlen(s);
      for(i = 0; i < ln; i++)
      {
          if((i % 2) == 0)
          {
              arr[j] = (int) s[i];
              j++;
          }
      }
      for(m = 1; m < j; m++)
     {
          for(n = 0; n < (j - m); n++)
         {
              if(arr[n] > arr[n + 1])
              {
                  temp = arr[n];
                  arr[n] = arr[n + 1];
                  arr[n + 1] = temp;
              }
          }
      }
      for(k = 0; k < j; k++)
      {
          if(k == (j - 1))
          {
              printf("%c", (char) arr[k]);
          }
          else
          {
              printf("%c%c", (char) arr[k], '+');
          }
      }
      printf("\n");

      return 0;
}


Codeforces Solution of 112A - Petya and Strings in C

Hi friends, I am going to post the solve of the problem '112A - Petya and Strings' of Codeforces.
The problem screenshot is given below:


Code: