Category: iOS Development

English Posting for iOS development

  • Data Structures and Algorithms for Coding Interviews – Essential Summary

    Data Structures and Algorithms for Coding Interviews – Essential Summary

    The coding interview is hard because We have to remember the basic data structures and algorithms. For me, I received masters degree of computer science seven years ago. Most of the tech companies require the coding interview when you apply for a job. So I decided to summarize the data structure and algorithm.

    Here is the list, and I’ll write the basic concept and will be solving problems using Swift

    Complexity

    • Time Complexity

    • Space Complexity

    Data Structures

    • Stack

    • Queue

    • Circular Queue

    • Linked List

    • Doubly Linked List

      1. Reverse Linked List

    • Hash Table

    • Tree

    • Binary Tree

      1. BFS

      2. DFS

        1. Pre-Order

          1. In-Order

          2. Post-Order

      3. Binary Search Tree [Ordered Binary Tree]

    • Dictionary

    • Set

    • Graph

    • Directed

      1. Undirected

      2. Graph using an Adjacency Matrix

      3. Graph using an Adjacency List and Set

      4. Depth First

      5. Breath First

      6. Topological Sort

      7. Weighted Graph

      8. Negative Weighted Graph

    Algorithms

    • Stack

      • Match parenthesis in an expression

      • find the minimum element in a expression

      • stack in constant time

    • Sorting

      • Selection Sort

      • Insertion Sort

      • Bubble Sort

      • Shell Sort

      • Merge Sort

      • Quick Sort

    • Search

      • Linear Search [Brute Force]

      • Binary Search [Sorted List]

    • Binary Tree

      • Find the minimum value in a Binary Search Tree

      • Find the maximum depth of a Binary Tree

      • Mirror a Binary Tree

      • Count the number of structurally unique binary tree possible

      • print all nodes within a range in a binary search tree

      • check if a binary tree is a binary search tree

      • check if a path from toot to leaf node sums up to a certain value

      • print all paths from the root to the leaf nodes

      • find the least common ancestor for 2 nodes

    • Heap [Priority Queue]

      • The Binary Heap

        1. Minimum Heap

        2. Maximum Heap

        3. Balanced Binary Search Tree

        4. An array or A list

        5. Insert and remove from a Heap

        6. Heapify

        7. Heap Sort

        8. Merge K sorted lists into one sorted array

        9. maximum element in a minimum heap and K largest elements in a stream

        10. Find the median In a stream of elements

    • Graph

      • Shortest path algorithm

      • Shortest path in a weighted graph

      • Dijkstra’s Algorithm [Greedy Algorithm]

      • Bellman Ford Algorithm [Shortest path in negative weighted graph] [Greedy Algorithm]

      • Dealing with negative cycles in the weighted graph [Bellman Ford Algorithm]

      • Prim’s Algorithm for a Minimal Spanning Tree [Undirected Graph] [Greedy Algorithm]

      • Kruskal’s Algorithm for a Minimal Spanning Tree for Forest [Priority Queue] [Connected / Unconnected]

      • Find the shortest path In a weight graph

      • Design A course schedule considering pre request for courses

    General Programming Problem

    • Basic Operation

    • Bit Manipulation

      • Set and Get n-th Bit

      • Print bits in Integer

      • Count the number of 1 bits

      • Reverse the bits in an Integer

    • Recursion

      • Find All subsets of A given set

      • Check whether 2 binary tree are the same

      • Paint Fill

      • Build A car given tasks and dependencies

      • Find all anagrams of a given word

      • Find a path a rat can travel through a maze

      • place 8 queens on a chess board

    • Palindrome

    • Find Distance

    • Run Length Encoding and Decoding

    • Game of Life

    • Break A Document Into Chunks

    • Add Two Numbers Represented by their Digits

    • Sudoku Validator

    • Incrementing A Number

     

    Thanks for reviewing my post

    Divjjot Singh ( 신승훈 )

  • How to render xib on Storyboard?

    How to render xib on Storyboard?

    When you create the custom view with xib and then set the custom view on Storyboard but if It has not appeared. How can you solve the rendering issue?

    I stuck in similar issues on Xcode 11.

    xcode 11 said -> Failed to render and update auto layout the agent threw an exception

    Here is my solution and I hope it helps you!

    customView.png

    import UIKit
    
    @IBDesignable
    class XibView: UIView {
        let className = String(describing: XibView.self)
        required init?(coder aDecoder: NSCoder) {
            super.init(coder: aDecoder)
            setupNib()
        }
    
        override init(frame: CGRect) {
            super.init(frame: frame)
            setupNib()
        }
    
        private func setupNib() {
            guard let nib = loadNib() else { return }   
            nib.translatesAutoresizingMaskIntoConstraints = false
            addSubview(nib)
            NSLayoutConstraint.activate([
                nib.leadingAnchor.constraint(equalTo: self.leadingAnchor),
                nib.trailingAnchor.constraint(equalTo: self.trailingAnchor),
                nib.topAnchor.constraint(equalTo: self.topAnchor),
                nib.bottomAnchor.constraint(equalTo: self.bottomAnchor)
            ])
        }
    
        func loadNib() -> UIView? {
            let bundle = Bundle(for: Self.self)
            return bundle.loadNibNamed(String(describing: Self.self), owner: self, options: nil)?.first as? UIView
        }
    }

    image-asset.png

  • How to enable syntax highlighting for Swift on Squarespace

    How to enable syntax highlighting for Swift on Squarespace

    Let’s enabling syntax highlighting for Swift

    The Squarespace supports syntax highlighting for HTML, CSS, and Javascript.

    But It does not support other programming languages.

    To enable it, We can choose the syntax highlighting plugins.

    I recommend PrismJS

    Download PrismJS css and javascript

    prismjs_compressionLevel.png

    Select PrismJS option before downloading it.

    • Compression level to Minified version

    • Language for Swift

    • Plugins (e.g., line numbers)

    prismjs_download.png

    Download the JS and CSS. That’s it.

    Copy and Paste it into the Squarespace

    EditingBlog.png

    Go to the setting Pages > Select your blog page (e.g., Posts)

    CodeInjection.png

    Go to Advanced tap and Copy and Paste the CSS and Javascript code into the Post Blog Item Code injection

    <style>
    <!-- Paste Your PrismJS CSS -->
    </style>
    <script>
    /*
    Paste your PrismJS Javascript
    */
    </script>

    Now We can syntax highlighting for Swift using Markdown

    markdown.png.jpeg

    let greeting = "Welcome to Shawn Baek's blog!"
    print(greeting)